[PD-cvs] pd/src desire.c,1.1.2.130,1.1.2.131

Mathieu Bouchard matju at users.sourceforge.net
Sat Sep 2 08:32:20 CEST 2006


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11148

Modified Files:
      Tag: devel_0_39
	desire.c 
Log Message:
reintroducing canvas_stowconnections


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.130
retrieving revision 1.1.2.131
diff -C2 -d -r1.1.2.130 -r1.1.2.131
*** desire.c	1 Sep 2006 21:36:33 -0000	1.1.2.130
--- desire.c	2 Sep 2006 06:32:17 -0000	1.1.2.131
***************
*** 876,893 ****
  
  /* kill all lines for one inlet or outlet */
! void canvas_deletelinesforio(t_canvas *x, t_text *text, t_inlet *inp, t_outlet *outp)
! {
      t_linetraverser t;
      t_outconnect *oc;
      linetraverser_start(&t, x);
!     while ((oc = linetraverser_next(&t)))
!     {
          if ((t.tr_ob == text && t.tr_outlet == outp) ||
              (t.tr_ob2 == text && t.tr_inlet == inp))
!         {
!             if (x->gl_editor)
!             {sys_vgui(".x%lx.c delete l%lx\n", (long)glist_getcanvas(x), (long)oc);}
!             obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
!         }
      }
  }
--- 876,887 ----
  
  /* kill all lines for one inlet or outlet */
! void canvas_deletelinesforio(t_canvas *x, t_text *text, t_inlet *inp, t_outlet *outp) {
      t_linetraverser t;
      t_outconnect *oc;
      linetraverser_start(&t, x);
!     while ((oc = linetraverser_next(&t))) {
          if ((t.tr_ob == text && t.tr_outlet == outp) ||
              (t.tr_ob2 == text && t.tr_inlet == inp))
! 		obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
      }
  }
***************
*** 1058,1075 ****
  static int tabcount = 0;
  
! static void *table_new(t_symbol *s, t_floatarg f)
! {
      t_atom a[9];
      t_glist *gl;
      t_canvas *x, *z = canvas_getcurrent();
!     if (s == &s_)
!     {
           char  tabname[255];
!          t_symbol *t = gensym("table"); 
           sprintf(tabname, "%s%d", t->s_name, tabcount++);
!          s = gensym(tabname); 
      }
!     if (f <= 1)
!         f = 100;
      SETFLOAT(a, 0);
      SETFLOAT(a+1, GLIST_DEFCANVASYLOC);
--- 1052,1066 ----
  static int tabcount = 0;
  
! static void *table_new(t_symbol *s, t_floatarg f) {
      t_atom a[9];
      t_glist *gl;
      t_canvas *x, *z = canvas_getcurrent();
!     if (s == &s_) {
           char  tabname[255];
!          t_symbol *t = gensym("table");
           sprintf(tabname, "%s%d", t->s_name, tabcount++);
!          s = gensym(tabname);
      }
!     if (f <= 1) f = 100;
      SETFLOAT(a, 0);
      SETFLOAT(a+1, GLIST_DEFCANVASYLOC);
***************
*** 1079,1130 ****
      SETFLOAT(a+5, 0);
      x = canvas_new(0, 0, 6, a);
- 
      x->gl_owner = z;
! 
!         /* create a graph for the table */
!     gl = glist_addglist((t_glist*)x, &s_, 0, -1, (f > 1 ? f-1 : 1), 1,
!         50, 350, 550, 50);
! 
      graph_array(gl, s, &s_float, f, 0);
- 
      canvas_pop(x, 0); 
! 
!     return (x);
  }
  
!     /* return true if the "canvas" object is an abstraction (so we don't
!     save its contents, fogr example.)  */
! int canvas_isabstraction(t_canvas *x)
! {
!     return (x->gl_env != 0);
! }
  
!     /* return true if the "canvas" object is a "table". */
! int canvas_istable(t_canvas *x)
! {
!     t_atom *argv = (x->gl_obj.te_binbuf? binbuf_getvec(x->gl_obj.te_binbuf):0);
!     int argc = (x->gl_obj.te_binbuf? binbuf_getnatom(x->gl_obj.te_binbuf) : 0);
!     int istable = (argc && argv[0].a_type == A_SYMBOL &&
!         argv[0].a_w.w_symbol == gensym("table"));
!     return (istable);
  }
  
!     /* return true if the "canvas" object should be treated as a text
!     object.  This is true for abstractions but also for "table"s... */
! int canvas_showtext(t_canvas *x)
! {
!     t_atom *argv = (x->gl_obj.te_binbuf? binbuf_getvec(x->gl_obj.te_binbuf):0);
!     int argc = (x->gl_obj.te_binbuf? binbuf_getnatom(x->gl_obj.te_binbuf) : 0);
!     int isarray = (argc && argv[0].a_type == A_SYMBOL &&
!         argv[0].a_w.w_symbol == gensym("graph"));
!     return (!isarray);
  }
  
!     /* get the document containing this canvas */
! t_canvas *canvas_getrootfor(t_canvas *x)
! {
!     if ((!x->gl_owner) || canvas_isabstraction(x))
!         return (x);
!     else return (canvas_getrootfor(x->gl_owner));
  }
  
--- 1070,1105 ----
      SETFLOAT(a+5, 0);
      x = canvas_new(0, 0, 6, a);
      x->gl_owner = z;
!     /* create a graph for the table */
!     gl = glist_addglist((t_glist*)x, &s_, 0, -1, (f > 1 ? f-1 : 1), 1, 50, 350, 550, 50);
      graph_array(gl, s, &s_float, f, 0);
      canvas_pop(x, 0); 
!     return x;
  }
  
! /* return true if the "canvas" object is an abstraction (so we don't
!    save its contents, fogr example.)  */
! int canvas_isabstraction(t_canvas *x) {return x->gl_env!=0;}
  
! /* return true if the "canvas" object is a "table". */
! int canvas_istable(t_canvas *x) {
!     t_atom *argv = x->gl_obj.te_binbuf ? binbuf_getvec(  x->gl_obj.te_binbuf) : 0;
!     int     argc = x->gl_obj.te_binbuf ? binbuf_getnatom(x->gl_obj.te_binbuf) : 0;
!     return argc && argv[0].a_type == A_SYMBOL && argv[0].a_w.w_symbol == gensym("table");
  }
  
! /* return true if the "canvas" object should be treated as a text
!    object.  This is true for abstractions but also for "table"s... */
! int canvas_showtext(t_canvas *x) {
!     t_atom *argv = x->gl_obj.te_binbuf? binbuf_getvec(  x->gl_obj.te_binbuf) : 0;
!     int     argc = x->gl_obj.te_binbuf? binbuf_getnatom(x->gl_obj.te_binbuf) : 0;
!     int isarray = argc && argv[0].a_type == A_SYMBOL && argv[0].a_w.w_symbol == gensym("graph");
!     return !isarray;
  }
  
! /* get the document containing this canvas */
! t_canvas *canvas_getrootfor(t_canvas *x) {
!     if (!x->gl_owner || canvas_isabstraction(x)) return x;
!     return canvas_getrootfor(x->gl_owner);
  }
  
***************
*** 1137,1145 ****
  void ugen_stop(void);
  
! t_dspcontext *ugen_start_graph(int toplevel, t_signal **sp,
!     int ninlets, int noutlets);
  void ugen_add(t_dspcontext *dc, t_object *x);
! void ugen_connect(t_dspcontext *dc, t_object *x1, int outno,
!     t_object *x2, int inno);
  void ugen_done_graph(t_dspcontext *dc);
  
--- 1112,1118 ----
  void ugen_stop(void);
  
! t_dspcontext *ugen_start_graph(int toplevel, t_signal **sp, int ninlets, int noutlets);
  void ugen_add(t_dspcontext *dc, t_object *x);
! void ugen_connect(t_dspcontext *dc, t_object *x1, int outno, t_object *x2, int inno);
  void ugen_done_graph(t_dspcontext *dc);
  
***************
*** 1148,1153 ****
      canvases, which are treated almost like any other tilde object.  */
  
! static void canvas_dodsp(t_canvas *x, int toplevel, t_signal **sp)
! {
      t_linetraverser t;
      t_outconnect *oc;
--- 1121,1125 ----
      canvases, which are treated almost like any other tilde object.  */
  
! static void canvas_dodsp(t_canvas *x, int toplevel, t_signal **sp) {
      t_linetraverser t;
      t_outconnect *oc;
***************
*** 1155,1174 ****
      t_object *ob;
      t_symbol *dspsym = gensym("dsp");
!     t_dspcontext *dc;    
! 
!         /* create a new "DSP graph" object to use in sorting this canvas.
!         If we aren't toplevel, there are already other dspcontexts around. */
  
      dc = ugen_start_graph(toplevel, sp,
          obj_nsiginlets(&x->gl_obj),
          obj_nsigoutlets(&x->gl_obj));
  
!         /* find all the "dsp" boxes and add them to the graph */
!     
      for (y = x->gl_list; y; y = y->g_next)
          if ((ob = pd_checkobject(&y->g_pd)) && zgetfn(&y->g_pd, dspsym))
              ugen_add(dc, ob);
  
!         /* ... and all dsp interconnections */
      linetraverser_start(&t, x);
      while ((oc = linetraverser_next(&t)))
--- 1127,1144 ----
      t_object *ob;
      t_symbol *dspsym = gensym("dsp");
!     t_dspcontext *dc;
  
+     /* create a new "DSP graph" object to use in sorting this canvas.
+        If we aren't toplevel, there are already other dspcontexts around. */
      dc = ugen_start_graph(toplevel, sp,
          obj_nsiginlets(&x->gl_obj),
          obj_nsigoutlets(&x->gl_obj));
  
!     /* find all the "dsp" boxes and add them to the graph */
      for (y = x->gl_list; y; y = y->g_next)
          if ((ob = pd_checkobject(&y->g_pd)) && zgetfn(&y->g_pd, dspsym))
              ugen_add(dc, ob);
  
!     /* ... and all dsp interconnections */
      linetraverser_start(&t, x);
      while ((oc = linetraverser_next(&t)))
***************
*** 1176,1206 ****
              ugen_connect(dc, t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
  
!         /* finally, sort them and add them to the DSP chain */
      ugen_done_graph(dc);
  }
  
! static void canvas_dsp(t_canvas *x, t_signal **sp)
! {
!     canvas_dodsp(x, 0, sp);
! }
  
      /* this routine starts DSP for all root canvases. */
! static void canvas_start_dsp(void)
! {
      t_canvas *x;
      if (canvas_dspstate) ugen_stop();
      else sys_gui("pdtk_pd_dsp 1\n");
      ugen_start();
!     
!     for (x = canvas_list; x; x = x->gl_next)
!         canvas_dodsp(x, 1, 0);
!     
      canvas_dspstate = 1;
  }
  
! static void canvas_stop_dsp(void)
! {
!     if (canvas_dspstate)
!     {
          ugen_stop();
          sys_gui("pdtk_pd_dsp 0\n");
--- 1146,1167 ----
              ugen_connect(dc, t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
  
!     /* finally, sort them and add them to the DSP chain */
      ugen_done_graph(dc);
  }
  
! static void canvas_dsp(t_canvas *x, t_signal **sp) {canvas_dodsp(x, 0, sp);}
  
      /* this routine starts DSP for all root canvases. */
! static void canvas_start_dsp(void) {
      t_canvas *x;
      if (canvas_dspstate) ugen_stop();
      else sys_gui("pdtk_pd_dsp 1\n");
      ugen_start();
!     for (x = canvas_list; x; x = x->gl_next) canvas_dodsp(x, 1, 0);
      canvas_dspstate = 1;
  }
  
! static void canvas_stop_dsp(void) {
!     if (canvas_dspstate) {
          ugen_stop();
          sys_gui("pdtk_pd_dsp 0\n");
***************
*** 1209,1219 ****
  }
  
!     /* DSP can be suspended before, and resumed after, operations which
!     might affect the DSP chain.  For example, we suspend before loading and
!     resume afterward, so that DSP doesn't get resorted for every DSP object
!     int the patch. */
! 
! int canvas_suspend_dsp(void)
! {
      int rval = canvas_dspstate;
      if (rval) canvas_stop_dsp();
--- 1170,1178 ----
  }
  
! /* DSP can be suspended before, and resumed after, operations which
!    might affect the DSP chain.  For example, we suspend before loading and
!    resume afterward, so that DSP doesn't get resorted for every DSP object
!    int the patch. */
! int canvas_suspend_dsp(void) {
      int rval = canvas_dspstate;
      if (rval) canvas_stop_dsp();
***************
*** 1221,1274 ****
  }
  
! void canvas_resume_dsp(int oldstate)
! {
      if (oldstate) canvas_start_dsp();
  }
  
!     /* this is equivalent to suspending and resuming in one step. */
! void canvas_update_dsp(void)
! {
      if (canvas_dspstate) canvas_start_dsp();
  }
  
! void glob_dsp(void *dummy, t_symbol *s, int argc, t_atom *argv)
! {
      int newstate;
!     if (argc)
!     {
          newstate = atom_getintarg(0, argc, argv);
!         if (newstate && !canvas_dspstate)
!         {
              canvas_start_dsp();
              sys_set_audio_state(1);
!         }
!         else if (!newstate && canvas_dspstate)
!         {
              sys_set_audio_state(0);
              canvas_stop_dsp();
          }
!     }
!     else post("dsp state %d", canvas_dspstate);
  }
  
! void *canvas_getblock(t_class *blockclass, t_canvas **canvasp)
! {
      t_canvas *canvas = *canvasp;
      t_gobj *g;
      void *ret = 0;
!     for (g = canvas->gl_list; g; g = g->g_next)
!     {
!         if (g->g_pd == blockclass)
!             ret = g;
!     }
      *canvasp = canvas->gl_owner;
!     return(ret);
  }
!     
  /******************* redrawing  data *********************/
  
!     /* redraw all "scalars" (do this if a drawing command is changed.) 
!     LATER we'll use the "template" information to select which ones we
!     redraw.   Action = 0 for redraw, 1 for draw only, 2 for erase. */
  static void glist_redrawall(t_glist *gl, int action) {
      t_gobj *g;
--- 1180,1220 ----
  }
  
! void canvas_resume_dsp(int oldstate) {
      if (oldstate) canvas_start_dsp();
  }
  
! /* this is equivalent to suspending and resuming in one step. */
! void canvas_update_dsp(void) {
      if (canvas_dspstate) canvas_start_dsp();
  }
  
! void glob_dsp(void *dummy, t_symbol *s, int argc, t_atom *argv) {
      int newstate;
!     if (argc) {
          newstate = atom_getintarg(0, argc, argv);
!         if (newstate && !canvas_dspstate) {
              canvas_start_dsp();
              sys_set_audio_state(1);
!         } else if (!newstate && canvas_dspstate) {
              sys_set_audio_state(0);
              canvas_stop_dsp();
          }
!     } else post("dsp state %d", canvas_dspstate);
  }
  
! void *canvas_getblock(t_class *blockclass, t_canvas **canvasp) {
      t_canvas *canvas = *canvasp;
      t_gobj *g;
      void *ret = 0;
!     for (g = canvas->gl_list; g; g = g->g_next) if (g->g_pd == blockclass) ret = g;
      *canvasp = canvas->gl_owner;
!     return ret;
  }
! 
  /******************* redrawing  data *********************/
  
! /* redraw all "scalars" (do this if a drawing command is changed.) 
!    LATER we'll use the "template" information to select which ones we
!    redraw.   Action = 0 for redraw, 1 for draw only, 2 for erase. */
  static void glist_redrawall(t_glist *gl, int action) {
      t_gobj *g;
***************
*** 1761,1772 ****
  }
  
! /* can someone please figure out what this and canvas_stowconnections are for? */
! void canvas_restoreconnections(t_canvas *x)
! {
! /*
      pd_bind(&x->gl_pd, gensym("#X"));
      binbuf_eval(x->gl_editor->e_connectbuf, 0, 0, 0);
      pd_unbind(&x->gl_pd, gensym("#X"));
- */
  }
  
--- 1707,1754 ----
  }
  
! void canvas_stowconnections(t_canvas *x, t_gobj *o) {
!     t_gobj *selhead = 0, *seltail = 0, *nonhead = 0, *nontail = 0, *y, *y2;
!     t_linetraverser t;
!     t_outconnect *oc;
!     t_binbuf *b;
!     if (!x->gl_editor) {error("canvas_stowconnections without editor"); return;}
!     b = x->gl_editor->e_connectbuf;
! 
!     /* split list to "selected" and "unselected" parts */
!     for (y = x->gl_list; y; y = y2) {
!         y2 = y->g_next;
!         if (y==o) {
!             if (seltail) {seltail->g_next = y; seltail = y; y->g_next = 0;}
!             else         {selhead = seltail = y; seltail->g_next = 0;}
!         } else {
!             if (nontail) {nontail->g_next = y; nontail = y; y->g_next = 0;}
!             else         {nonhead = nontail = y; nontail->g_next = 0;}
!         }
!     }
!     /* move the selected part to the end */
!     if (!nonhead) x->gl_list = selhead;
!     else x->gl_list = nonhead, nontail->g_next = selhead;
!     /* add connections to binbuf */
!     binbuf_clear(b);
!     linetraverser_start(&t, x);
!     while ((oc = linetraverser_next(&t))) {
!         /*int s1 = glist_isselected(x, &t.tr_ob->ob_g);*/
!         /*int s2 = glist_isselected(x, &t.tr_ob2->ob_g);*/
! 	int s1 = o == (t_gobj *)t.tr_ob;
! 	int s2 = o == (t_gobj *)t.tr_ob2;
!         if (s1 != s2)
!             binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"),
!                 glist_getindex(x, &t.tr_ob->ob_g), t.tr_outno,
!                 glist_getindex(x, &t.tr_ob2->ob_g), t.tr_inno);
!     }
!     post("<canvas_stowconnections>");
!     binbuf_print(x->gl_editor->e_connectbuf);
!     post("</canvas_stowconnections>");
! }
! 
! void canvas_restoreconnections(t_canvas *x) {
      pd_bind(&x->gl_pd, gensym("#X"));
      binbuf_eval(x->gl_editor->e_connectbuf, 0, 0, 0);
      pd_unbind(&x->gl_pd, gensym("#X"));
  }
  
***************
*** 3144,3149 ****
  
  /* delete an object from a glist and free it */
! void glist_delete(t_glist *x, t_gobj *y)
! {
      t_gobj *g;
      t_object *ob;
--- 3126,3130 ----
  
  /* delete an object from a glist and free it */
! void glist_delete(t_glist *x, t_gobj *y) {
      t_gobj *g;
      t_object *ob;
***************
*** 3157,3168 ****
         it; we'll redraw them once it's deleted below. */
      if (drawcommand)
!         canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(
!             glist_getcanvas(x)->gl_name)), 2);
      gobj_delete(y, x);
-     /*if (glist_isvisible(canvas)) gobj_vis(y,x,0);*/
-     if (glist_isvisible(canvas)) {
- 	/*!@#$ race condition because the queue might still contain something */
- 	/*sys_mgui(y,"delete","");*/ //???
-     }
  
      if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob);
--- 3138,3146 ----
         it; we'll redraw them once it's deleted below. */
      if (drawcommand)
!         canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(glist_getcanvas(x)->gl_name)), 2);
! 
!     /* shouldn't all connections to the object be deleted before gobj_delete ? */
! 
      gobj_delete(y, x);
  
      if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob);
***************
*** 3175,3180 ****
      if (chkdsp) canvas_update_dsp();
      if (drawcommand)
!         canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(
!             glist_getcanvas(x)->gl_name)), 1);
      canvas_setdeleting(canvas, wasdeleting);
      x->gl_valid = ++glist_valid;
--- 3153,3157 ----
      if (chkdsp) canvas_update_dsp();
      if (drawcommand)
!         canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(glist_getcanvas(x)->gl_name)), 1);
      canvas_setdeleting(canvas, wasdeleting);
      x->gl_valid = ++glist_valid;
***************
*** 8691,8708 ****
  
      gobj_vis(&x->a_text.te_g, x->a_glist, 0);
!     if (!*symfrom->s_name && *x->a_symfrom->s_name)
!     	inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0);
!     else if (*symfrom->s_name && !*x->a_symfrom->s_name && x->a_text.te_inlet)
!     {
!     	canvas_deletelinesforio(x->a_glist, &x->a_text,
! 	    x->a_text.te_inlet, 0);
  	inlet_free(x->a_text.te_inlet);
      }
!     if (!*symto->s_name && *x->a_symto->s_name)
!     	outlet_new(&x->a_text, 0);
!     else if (*symto->s_name && !*x->a_symto->s_name && x->a_text.te_outlet)
!     {
!     	canvas_deletelinesforio(x->a_glist, &x->a_text,
! 	    0, x->a_text.te_outlet);
  	outlet_free(x->a_text.te_outlet);
      }
--- 8668,8679 ----
  
      gobj_vis(&x->a_text.te_g, x->a_glist, 0);
!     if (!*symfrom->s_name && *x->a_symfrom->s_name) inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0);
!     else if (*symfrom->s_name && !*x->a_symfrom->s_name && x->a_text.te_inlet) {
!     	canvas_deletelinesforio(x->a_glist, &x->a_text, x->a_text.te_inlet, 0);
  	inlet_free(x->a_text.te_inlet);
      }
!     if (!*symto->s_name && *x->a_symto->s_name) outlet_new(&x->a_text, 0);
!     else if (*symto->s_name && !*x->a_symto->s_name && x->a_text.te_outlet) {
!     	canvas_deletelinesforio(x->a_glist, &x->a_text, 0, x->a_text.te_outlet);
  	outlet_free(x->a_text.te_outlet);
      }
***************
*** 8714,8726 ****
      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); */
  }
  
--- 8685,8694 ----
      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_changed(x,0);
  }
  
***************
*** 8885,8902 ****
  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;
  	t_atom *vec1, *vec2;
!     	binbuf_text(b, buf, bufsize);
  	natom1 = binbuf_getnatom(x->te_binbuf);
  	vec1 = binbuf_getvec(x->te_binbuf);
  	natom2 = binbuf_getnatom(b);
  	vec2 = binbuf_getvec(b);
! 	    /* special case: if  pd args change just pass the message on. */
! 	if (natom1 >= 1 && natom2 >= 1 && vec1[0].a_type == A_SYMBOL
! 	    && !strcmp(vec1[0].a_w.w_symbol->s_name, "pd") &&
! 	     vec2[0].a_type == A_SYMBOL
! 	    && !strcmp(vec2[0].a_w.w_symbol->s_name, "pd"))
! 	{
  	    typedmess(&x->te_pd, gensym("rename"), natom2-1, vec2+1);
  	    binbuf_free(x->te_binbuf);
--- 8853,8868 ----
  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;
  	t_atom *vec1, *vec2;
! 	binbuf_text(b, buf, bufsize);
  	natom1 = binbuf_getnatom(x->te_binbuf);
  	vec1 = binbuf_getvec(x->te_binbuf);
  	natom2 = binbuf_getnatom(b);
  	vec2 = binbuf_getvec(b);
! 	/* special case: if  pd args change just pass the message on. */
! 	if (natom1 >= 1 && natom2 >= 1 &&
! 	  vec1[0].a_type == A_SYMBOL && !strcmp(vec1[0].a_w.w_symbol->s_name, "pd") &&
! 	  vec2[0].a_type == A_SYMBOL && !strcmp(vec2[0].a_w.w_symbol->s_name, "pd")) {
  	    typedmess(&x->te_pd, gensym("rename"), natom2-1, vec2+1);
  	    binbuf_free(x->te_binbuf);
***************
*** 8904,8916 ****
  	} else {
  	    int xwas = x->te_xpix, ywas = x->te_ypix;
!     	    glist_delete(glist, &x->te_g);
!     	    canvas_objtext(glist, xwas, ywas, 0, b);
! 	    	/* if it's an abstraction loadbang it here */
! 	    if (newest && pd_class(newest) == canvas_class)
!     	    	canvas_loadbang((t_canvas *)newest);
!     	    canvas_restoreconnections(glist_getcanvas(glist));
!     	}
!     }
!     else binbuf_text(x->te_binbuf, buf, bufsize);
  }
  
--- 8870,8881 ----
  	} else {
  	    int xwas = x->te_xpix, ywas = x->te_ypix;
! 	    canvas_stowconnections(glist_getcanvas(glist), (t_gobj *)x);
! 	    glist_delete(glist, (t_gobj *)x);
! 	    canvas_objtext(glist, xwas, ywas, 0, b);
! 	    /* if it's an abstraction loadbang it here */
! 	    if (newest && pd_class(newest) == canvas_class) canvas_loadbang((t_canvas *)newest);
! 	    canvas_restoreconnections(glist_getcanvas(glist));
! 	}
!     } else binbuf_text(x->te_binbuf, buf, bufsize);
  }
  





More information about the Pd-cvs mailing list