[PD-cvs] pd/src desire.c,1.1.2.116,1.1.2.117

Mathieu Bouchard matju at users.sourceforge.net
Mon Aug 21 02:04:31 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.c 
Log Message:
trying to code objectbox deletion undo...


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.116
retrieving revision 1.1.2.117
diff -C2 -d -r1.1.2.116 -r1.1.2.117
*** desire.c	20 Aug 2006 21:46:58 -0000	1.1.2.116
--- desire.c	21 Aug 2006 00:04:29 -0000	1.1.2.117
***************
*** 282,286 ****
  t_class *canvas_class;
  int canvas_dspstate;                /* whether DSP is on or off */  
- t_canvas *canvas_editing;           /* last canvas to start text edting */ 
  t_canvas *canvas_whichfind;         /* last canvas we did a find in */ 
  t_canvas *canvas_list;              /* list of all root canvases */
--- 282,285 ----
***************
*** 898,920 ****
  }
  
! int glist_isvisible(t_glist *x)
! {
!     return ((!x->gl_loading) && glist_getcanvas(x)->gl_mapped);
! }
  
! int glist_istoplevel(t_glist *x)
! {
!         /* we consider a graph "toplevel" if it has its own window
!         or if it appears as a box in its parent window so that we
!         don't draw the actual contents there. */
!     return (x->gl_havewindow || !x->gl_isgraph);
! }
  
! int glist_getfont(t_glist *x)
! {
!     while (!x->gl_env)
!         if (!(x = x->gl_owner))
!             bug("t_canvasenvironment");
!     return (x->gl_font);
  }
  
--- 897,910 ----
  }
  
! int glist_isvisible(t_glist *x) {return !x->gl_loading && glist_getcanvas(x)->gl_mapped;}
  
! /* we consider a graph "toplevel" if it has its own window
! or if it appears as a box in its parent window so that we
! don't draw the actual contents there. */
! int glist_istoplevel(t_glist *x) {return x->gl_havewindow || !x->gl_isgraph;}
  
! int glist_getfont(t_glist *x) {
!     while (!x->gl_env) if (!(x = x->gl_owner)) bug("t_canvasenvironment");
!     return x->gl_font;
  }
  
***************
*** 923,927 ****
      t_gobj *y;
      int dspstate = canvas_suspend_dsp();
-     if (canvas_editing == x)   canvas_editing = 0;
      if (canvas_whichfind == x) canvas_whichfind = 0;
      glist_noselect(x);
--- 913,916 ----
***************
*** 929,937 ****
      canvas_vis(x, 0);
      sys_mgui(x,"delete","");
- 
      if (strcmp(x->gl_name->s_name, "Pd"))
          pd_unbind(&x->gl_pd, canvas_makebindsym(x->gl_name));
!     if (x->gl_env)
!     {
          freebytes(x->gl_env->ce_argv, x->gl_env->ce_argc * sizeof(t_atom));
          freebytes(x->gl_env, sizeof(*x->gl_env));
--- 918,924 ----
      canvas_vis(x, 0);
      sys_mgui(x,"delete","");
      if (strcmp(x->gl_name->s_name, "Pd"))
          pd_unbind(&x->gl_pd, canvas_makebindsym(x->gl_name));
!     if (x->gl_env) {
          freebytes(x->gl_env->ce_argv, x->gl_env->ce_argc * sizeof(t_atom));
          freebytes(x->gl_env, sizeof(*x->gl_env));
***************
*** 939,945 ****
      canvas_resume_dsp(dspstate);
      glist_cleanup(x);
!     gfxstub_deleteforkey(x);        /* probably unnecessary */
!     if (!x->gl_owner)
!         canvas_takeofflist(x);
  }
  
--- 926,931 ----
      canvas_resume_dsp(dspstate);
      glist_cleanup(x);
!     gfxstub_deleteforkey(x); /* probably unnecessary */
!     if (!x->gl_owner) canvas_takeofflist(x);
  }
  
***************
*** 954,961 ****
  }
  
! void canvas_fixlinesfor(t_canvas *x, t_text *text)
! {sys_mgui(text,"draw_wires","");}
! void canvas_deletelinesfor(t_canvas *x, t_text *text)
! {sys_mgui(text,"delete_wires","");}
  
  /* kill all lines for one inlet or outlet */
--- 940,944 ----
  }
  
! void canvas_fixlinesfor(t_canvas *x, t_text *text) {sys_mgui(text,"draw_wires","");}
  
  /* kill all lines for one inlet or outlet */
***************
*** 989,1009 ****
  void canvas_objfor(t_glist *gl, t_text *x, int argc, t_atom *argv);
  
- 
  void canvas_restore(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
! { /* IOhannes */
      t_pd *z;
          /* this should be unnecessary, but sometimes the canvas's name gets
          out of sync with the owning box's argument; this fixes that */
!     if (argc > 3)
!     {
          t_atom *ap=argv+3;
!         if (ap->a_type == A_SYMBOL)
!         {
              char *buf=ap->a_w.w_symbol->s_name, *bufp;
!             if (*buf == '$' && buf[1] >= '0' && buf[1] <= '9')
!             {
!                 for (bufp = buf+2; *bufp; bufp++)
!                     if (*bufp < '0' || *bufp > '9')
!                 {
                      SETDOLLSYM(ap, gensym(buf+1));
                      goto didit;
--- 972,986 ----
  void canvas_objfor(t_glist *gl, t_text *x, int argc, t_atom *argv);
  
  void canvas_restore(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
! {
      t_pd *z;
          /* this should be unnecessary, but sometimes the canvas's name gets
          out of sync with the owning box's argument; this fixes that */
!     if (argc > 3) {
          t_atom *ap=argv+3;
!         if (ap->a_type == A_SYMBOL) {
              char *buf=ap->a_w.w_symbol->s_name, *bufp;
!             if (*buf == '$' && buf[1] >= '0' && buf[1] <= '9') {
!                 for (bufp = buf+2; *bufp; bufp++) if (*bufp < '0' || *bufp > '9') {
                      SETDOLLSYM(ap, gensym(buf+1));
                      goto didit;
***************
*** 1013,1024 ****
              }
          }
! 
!         if (ap->a_type == A_DOLLSYM)
!         {
              t_canvasenvironment *e = canvas_getenv(canvas_getcurrent());
              canvas_rename(x, binbuf_realizedollsym(ap->a_w.w_symbol,
                  e->ce_argc, e->ce_argv, 1), 0); 
!         }
!         else if (ap->a_type == A_SYMBOL)
            canvas_rename(x, argv[3].a_w.w_symbol, 0);
      }
--- 990,998 ----
              }
          }
!         if (ap->a_type == A_DOLLSYM) {
              t_canvasenvironment *e = canvas_getenv(canvas_getcurrent());
              canvas_rename(x, binbuf_realizedollsym(ap->a_w.w_symbol,
                  e->ce_argc, e->ce_argv, 1), 0); 
!         } else if (ap->a_type == A_SYMBOL)
            canvas_rename(x, argv[3].a_w.w_symbol, 0);
      }
***************
*** 1027,1032 ****
      if (!z) error("canvas_restore: out of context");
      else if (*z != canvas_class) error("canvas_restore: wasn't a canvas");
!     else
!     {
          t_canvas *x2 = (t_canvas *)z;
          x->gl_owner = x2;
--- 1001,1005 ----
      if (!z) error("canvas_restore: out of context");
      else if (*z != canvas_class) error("canvas_restore: wasn't a canvas");
!     else {
          t_canvas *x2 = (t_canvas *)z;
          x->gl_owner = x2;
***************
*** 2270,2374 ****
  #define NHIST 15
  
-     /* LATER might have to speed this up */
- static void canvas_tidy(t_canvas *x)
- {
-     t_gobj *y, *y2;
-     int ax1, ay1, ax2, ay2, bx1, by1, bx2, by2;
-     int histogram[NHIST], *ip, i, besthist, bestdist;
-         /* if nobody is selected, this means do it to all boxes;
-         othewise just the selection */
-     int all = (x->gl_editor ? (x->gl_editor->e_selection == 0) : 1);
- 
-         /* tidy horizontally */
-     for (y = x->gl_list; y; y = y->g_next)
-         if (all || glist_isselected(x, y))
-     {
-         gobj_getrect(y, x, &ax1, &ay1, &ax2, &ay2);
- 
-         for (y2 = x->gl_list; y2; y2 = y2->g_next)
-             if (all || glist_isselected(x, y2))
-         {
-             gobj_getrect(y2, x, &bx1, &by1, &bx2, &by2);
-             if (by1 <= ay1 + YTOLERANCE && by1 >= ay1 - YTOLERANCE &&
-                 bx1 < ax1)
-                     goto nothorizhead;
-         }
- 
-         for (y2 = x->gl_list; y2; y2 = y2->g_next)
-             if (all || glist_isselected(x, y2))
-         {
-             gobj_getrect(y2, x, &bx1, &by1, &bx2, &by2);
-             if (by1 <= ay1 + YTOLERANCE && by1 >= ay1 - YTOLERANCE
-                 && by1 != ay1)
-                     gobj_displace(y2, x, 0, ay1-by1);
-         }
-     nothorizhead: ;
-     }
-         /* tidy vertically.  First guess the user's favorite vertical spacing */
-     for (i = NHIST, ip = histogram; i--; ip++) *ip = 0;
-     for (y = x->gl_list; y; y = y->g_next)
-         if (all || glist_isselected(x, y))
-     {
-         gobj_getrect(y, x, &ax1, &ay1, &ax2, &ay2);
-         for (y2 = x->gl_list; y2; y2 = y2->g_next)
-             if (all || glist_isselected(x, y2))
-         {
-             gobj_getrect(y2, x, &bx1, &by1, &bx2, &by2);
-             if (bx1 <= ax1 + XTOLERANCE && bx1 >= ax1 - XTOLERANCE)
-             {
-                 int distance = by1-ay2;
-                 if (distance >= 0 && distance < NHIST)
-                     histogram[distance]++;
-             }
-         }
-     }
-     for (i = 1, besthist = 0, bestdist = 4, ip = histogram + 1;
-         i < (NHIST-1); i++, ip++)
-     {
-         int hit = ip[-1] + 2 * ip[0] + ip[1];
-         if (hit > besthist)
-         {
-             besthist = hit;
-             bestdist = i;
-         }
-     }
-     post("best vertical distance %d", bestdist);
-     for (y = x->gl_list; y; y = y->g_next)
-         if (all || glist_isselected(x, y))
-     {
-         int keep = 1;
-         gobj_getrect(y, x, &ax1, &ay1, &ax2, &ay2);
-         for (y2 = x->gl_list; y2; y2 = y2->g_next)
-             if (all || glist_isselected(x, y2))
-         {
-             gobj_getrect(y2, x, &bx1, &by1, &bx2, &by2);
-             if (bx1 <= ax1 + XTOLERANCE && bx1 >= ax1 - XTOLERANCE &&
-                 ay1 >= by2 - 10 && ay1 < by2 + NHIST)
-                     goto nothead;
-         }
-         while (keep)
-         {
-             keep = 0;
-             for (y2 = x->gl_list; y2; y2 = y2->g_next)
-                 if (all || glist_isselected(x, y2))
-             {
-                 gobj_getrect(y2, x, &bx1, &by1, &bx2, &by2);
-                 if (bx1 <= ax1 + XTOLERANCE && bx1 >= ax1 - XTOLERANCE &&
-                     by1 > ay1 && by1 < ay2 + NHIST)
-                 {
-                     int vmove = ay2 + bestdist - by1;
-                     gobj_displace(y2, x, ax1-bx1, vmove);
-                     ay1 = by1 + vmove;
-                     ay2 = by2 + vmove;
-                     keep = 1;
-                     break;
-                 }
-             }
-         }
-     nothead: ;
-     }
-     canvas_dirty(x, 1);
- }
- 
  static void canvas_texteditor(t_canvas *x)
  {
--- 2243,2246 ----
***************
*** 4884,4894 ****
              }
          }
!         else if (template->t_vec[i].ds_type == DT_LIST)
!         {
!             while (1)
!             {
!                 if (!glist_readscalar(w->w_list, natoms, vec,
!                     p_nextmsg, 0))
!                         break;
              }
          }
--- 4756,4762 ----
              }
          }
!         else if (template->t_vec[i].ds_type == DT_LIST) {
!             while (1) {
!                 if (!glist_readscalar(w->w_list, natoms, vec, p_nextmsg, 0)) break;
              }
          }
***************
*** 4906,4913 ****
      int wasvis = glist_isvisible(x);
  
!     if (nextmsg >= natoms || vec[nextmsg].a_type != A_SYMBOL)
!     {
!         if (nextmsg < natoms)
!             post("stopping early: type %d", vec[nextmsg].a_type);
          *p_nextmsg = natoms;
          return (0);
--- 4774,4779 ----
      int wasvis = glist_isvisible(x);
  
!     if (nextmsg >= natoms || vec[nextmsg].a_type != A_SYMBOL) {
!         if (nextmsg < natoms) post("stopping early: type %d", vec[nextmsg].a_type);
          *p_nextmsg = natoms;
          return (0);
***************
*** 4915,4921 ****
      templatesym = canvas_makebindsym(vec[nextmsg].a_w.w_symbol);
      *p_nextmsg = nextmsg + 1;
!     
!     if (!(template = template_findbyname(templatesym)))
!     {
          error("canvas_read: %s: no such template", templatesym->s_name);
          *p_nextmsg = natoms;
--- 4781,4786 ----
      templatesym = canvas_makebindsym(vec[nextmsg].a_w.w_symbol);
      *p_nextmsg = nextmsg + 1;
! 
!     if (!(template = template_findbyname(templatesym))) {
          error("canvas_read: %s: no such template", templatesym->s_name);
          *p_nextmsg = natoms;
***************
*** 4923,4953 ****
      }
      sc = scalar_new(x, templatesym);
!     if (!sc)
!     {
          error("couldn't create scalar \"%s\"", templatesym->s_name);
          *p_nextmsg = natoms;
          return (0);
      }
!     if (wasvis)
!     {
!             /* temporarily lie about vis flag while this is built */
          glist_getcanvas(x)->gl_mapped = 0;
      }
      glist_add(x, &sc->sc_gobj);
-     
      nline = canvas_scanbinbuf(natoms, vec, &message, p_nextmsg);
!     glist_readatoms(x, natoms, vec, p_nextmsg, templatesym, sc->sc_vec, 
!         nline, vec + message);
!     if (wasvis)
!     {
!             /* reset vis flag as before */
          glist_getcanvas(x)->gl_mapped = 1;
          gobj_vis(&sc->sc_gobj, x, 1);
      }
!     if (selectit)
!     {
!         glist_select(x, &sc->sc_gobj);
!     }
!     return (1);
  }
  
--- 4788,4810 ----
      }
      sc = scalar_new(x, templatesym);
!     if (!sc) {
          error("couldn't create scalar \"%s\"", templatesym->s_name);
          *p_nextmsg = natoms;
          return (0);
      }
!     if (wasvis) {
!         /* temporarily lie about vis flag while this is built */
          glist_getcanvas(x)->gl_mapped = 0;
      }
      glist_add(x, &sc->sc_gobj);
      nline = canvas_scanbinbuf(natoms, vec, &message, p_nextmsg);
!     glist_readatoms(x, natoms, vec, p_nextmsg, templatesym, sc->sc_vec, nline, vec + message);
!     if (wasvis) {
!         /* reset vis flag as before */
          glist_getcanvas(x)->gl_mapped = 1;
          gobj_vis(&sc->sc_gobj, x, 1);
      }
!     if (selectit) glist_select(x, &sc->sc_gobj);
!     return 1;
  }
  
***************
*** 5028,5070 ****
  }
  
! static void glist_doread(t_glist *x, t_symbol *filename, t_symbol *format,
!     int clearme)
! {
      t_binbuf *b = binbuf_new();
      t_canvas *canvas = glist_getcanvas(x);
      int wasvis = glist_isvisible(canvas);
      int cr = 0;
  
!     if (!strcmp(format->s_name, "cr"))
!         cr = 1;
!     else if (*format->s_name)
!         error("qlist_read: unknown flag: %s", format->s_name);
!     
!     if (binbuf_read_via_path(b, filename->s_name,
!         canvas_getdir(canvas)->s_name, cr))
!     {
          pd_error(x, "read failed");
          binbuf_free(b);
          return;
      }
!     if (wasvis)
!         canvas_vis(canvas, 0);
!     if (clearme)
!         glist_clear(x);
      glist_readfrombinbuf(x, b, filename->s_name, 0);
!     if (wasvis)
!         canvas_vis(canvas, 1);
      binbuf_free(b);
  }
  
  void glist_read(t_glist *x, t_symbol *filename, t_symbol *format)
! {
!     glist_doread(x, filename, format, 1);
! }
! 
  void glist_mergefile(t_glist *x, t_symbol *filename, t_symbol *format)
! {
!     glist_doread(x, filename, format, 0);
! }
  
      /* read text from a "properties" window, called from a gfxstub set
--- 4885,4912 ----
  }
  
! static void glist_doread(t_glist *x, t_symbol *filename, t_symbol *format, int clearme) {
      t_binbuf *b = binbuf_new();
      t_canvas *canvas = glist_getcanvas(x);
      int wasvis = glist_isvisible(canvas);
      int cr = 0;
+     if (!strcmp(format->s_name, "cr")) cr = 1;
+     else if (*format->s_name) error("glist_read: unknown flag: %s", format->s_name);
  
!     if (binbuf_read_via_path(b, filename->s_name, canvas_getdir(canvas)->s_name, cr)) {
          pd_error(x, "read failed");
          binbuf_free(b);
          return;
      }
!     if (wasvis) canvas_vis(canvas, 0);
!     if (clearme) glist_clear(x);
      glist_readfrombinbuf(x, b, filename->s_name, 0);
!     if (wasvis) canvas_vis(canvas, 1);
      binbuf_free(b);
  }
  
  void glist_read(t_glist *x, t_symbol *filename, t_symbol *format)
! {glist_doread(x, filename, format, 1);}
  void glist_mergefile(t_glist *x, t_symbol *filename, t_symbol *format)
! {glist_doread(x, filename, format, 0);}
  
      /* read text from a "properties" window, called from a gfxstub set
***************
*** 5075,5113 ****
      int ntotal, nnew, scindex;
      t_gobj *y, *y2 = 0, *newone, *oldone = 0;
!     for (y = x->gl_list, ntotal = 0, scindex = -1; y; y = y->g_next)
!     {
!         if (y == &sc->sc_gobj)
!             scindex = ntotal, oldone = y;
          ntotal++;
      }
!     
      if (scindex == -1)
          bug("data_properties: scalar disappeared");
      glist_readfrombinbuf(x, b, "properties dialog", 0);
      newone = 0;
!     if (scindex >= 0)
!     {
          /* take the new object off the list */
!         if (ntotal)
!         {
!             for (y = x->gl_list, nnew = 1; (y2 = y->g_next); y = y2, nnew++)
!                     if (nnew == ntotal)
!             {
                  newone = y2;
                  y->g_next = y2->g_next;
!                 break;    
              }
          }
          else newone = x->gl_list, x->gl_list = newone->g_next;
      }
!     if (!newone)
!         error("couldn't update properties (perhaps a format problem?)");
!     else if (!oldone)
!         bug("data_properties: couldn't find old element");
!     else
!     {
          glist_delete(x, oldone);
!         if (scindex > 0)
!         {
              for (y = x->gl_list, nnew = 1; y;
                  y = y->g_next, nnew++)
--- 4917,4945 ----
      int ntotal, nnew, scindex;
      t_gobj *y, *y2 = 0, *newone, *oldone = 0;
!     for (y = x->gl_list, ntotal = 0, scindex = -1; y; y = y->g_next) {
!         if (y == &sc->sc_gobj) {scindex = ntotal; oldone = y;}
          ntotal++;
      }
! 
      if (scindex == -1)
          bug("data_properties: scalar disappeared");
      glist_readfrombinbuf(x, b, "properties dialog", 0);
      newone = 0;
!     if (scindex >= 0) {
          /* take the new object off the list */
!         if (ntotal) {
!             for (y = x->gl_list, nnew = 1; (y2 = y->g_next); y = y2, nnew++) if (nnew == ntotal) {
                  newone = y2;
                  y->g_next = y2->g_next;
!                 break;
              }
          }
          else newone = x->gl_list, x->gl_list = newone->g_next;
      }
!     if (!newone)      error("couldn't update properties (perhaps a format problem?)");
!     else if (!oldone) bug("data_properties: couldn't find old element");
!     else {
          glist_delete(x, oldone);
!         if (scindex > 0) {
              for (y = x->gl_list, nnew = 1; y;
                  y = y->g_next, nnew++)
***************
*** 9533,9537 ****
  void canvas_getargs(int *argcp, t_atom **argvp);
  
! static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected, t_binbuf *b) {
      t_text *x=0;
      int argc, n;
--- 9365,9370 ----
  void canvas_getargs(int *argcp, t_atom **argvp);
  
! /* i = insertion point; -1 = end */
! static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected, t_binbuf *b, int i) {
      t_text *x=0;
      int argc, n;
***************
*** 9564,9568 ****
      	gobj_activate(&x->te_g, gl, 1);
      }
!     if (pd_class(&x->ob_pd) == vinlet_class)  canvas_resortinlets(glist_getcanvas(gl));
      if (pd_class(&x->ob_pd) == voutlet_class) canvas_resortoutlets(glist_getcanvas(gl));
      canvas_unsetcurrent((t_canvas *)gl);
--- 9397,9401 ----
      	gobj_activate(&x->te_g, gl, 1);
      }
!     if (pd_class(&x->ob_pd) ==  vinlet_class)  canvas_resortinlets(glist_getcanvas(gl));
      if (pd_class(&x->ob_pd) == voutlet_class) canvas_resortoutlets(glist_getcanvas(gl));
      canvas_unsetcurrent((t_canvas *)gl);
***************
*** 9574,9578 ****
      	binbuf_restore(b, argc-2, argv+2);
      	canvas_objtext(gl, atom_getintarg(0, argc, argv),
!     	    atom_getintarg(1, argc, argv), 0, b);
      } else {
      	int xpix, ypix;
--- 9407,9411 ----
      	binbuf_restore(b, argc-2, argv+2);
      	canvas_objtext(gl, atom_getintarg(0, argc, argv),
!     	    atom_getintarg(1, argc, argv), 0, b, -1);
      } else {
      	int xpix, ypix;
***************
*** 9580,9584 ****
      	glist_noselect(gl);
      	glist_getnextxy(gl, &xpix, &ypix);
!     	canvas_objtext(gl, xpix, ypix, 1, b);
      	canvas_startmotion(glist_getcanvas(gl));
      }
--- 9413,9417 ----
      	glist_noselect(gl);
      	glist_getnextxy(gl, &xpix, &ypix);
!     	canvas_objtext(gl, xpix, ypix, 1, b, -1);
      	canvas_startmotion(glist_getcanvas(gl));
      }
***************
*** 9594,9598 ****
      binbuf_restore(b, 1, &at);
      glist_getnextxy(gl, &xpix, &ypix);
!     canvas_objtext(gl, xpix, ypix, 1, b);
      canvas_startmotion(glist_getcanvas(gl));
  }
--- 9427,9431 ----
      binbuf_restore(b, 1, &at);
      glist_getnextxy(gl, &xpix, &ypix);
!     canvas_objtext(gl, xpix, ypix, 1, b, -1);
      canvas_startmotion(glist_getcanvas(gl));
  }
***************
*** 10100,10105 ****
  };
  
- void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, char *tag, int x1, int y1, int x2, int y2) {}
- 
  void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize) {
      if (x->te_type == T_OBJECT) {
--- 9933,9936 ----
***************
*** 10124,10128 ****
  	    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)
--- 9955,9959 ----
  	    int xwas = x->te_xpix, ywas = x->te_ypix;
      	    glist_delete(glist, &x->te_g);
!     	    canvas_objtext(glist, xwas, ywas, 0, b, -1);
  	    	/* if it's an abstraction loadbang it here */
  	    if (newest && pd_class(newest) == canvas_class)
***************
*** 10161,10174 ****
  
  /*
! static void canvas_object_insert(t_canvas *x, int argc, t_atom *argv) {
  	t_text *o;
! 	t_symbol *name;
! 	if (argc<1 || argv[0]->a_type != T_SYMBOL) {error("$1 must be symbol"); return;}
! 	name = atom_getsymbol(argv[0]);
! 	if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {error("gargamel was here"); return;}
! 	glist_delete(x,(t_gobj *)o);
  	gobj_changed(x,0);
  }
- */
  
  void g_text_setup(void) {
--- 9992,10019 ----
  
  /*
! static void canvas_reorder_last(t_canvas *x, int dest) {
! 	t_gobj *y = x->gl_list;
!         for (y = x->gl_list; y->g_next; y = y2->g_next) {}
! 	if (y==x->gl_list) return;
!         y->g_next = y;
! }
! */
! 
! /* this supposes that $2=#X and $3=obj */
! static void canvas_object_insert(t_canvas *x, t_symbol *s, int argc, t_atom *argv) {
  	t_text *o;
! 	t_binbuf *b;
! 	int i;
! 	if (argc<1) {error("not enough args"); return;}
! 	if (argv[0].a_type != A_FLOAT) {error("$1 must be float"); return;}
! 	i = atom_getfloat(argv);
! 	printf("canvas_object_insert: HELLO\n");
!         b = binbuf_new();
!     	binbuf_restore(b, argc-5, argv+5);
!     	canvas_objtext(x,atom_getintarg(3,argc,argv),atom_getintarg(4,argc,argv),0,b,-1);
! 	/*canvas_reorder_last(x,i);*/
  	gobj_changed(x,0);
+ /*err: canvas_unsetcurrent(x);*/
  }
  
  void g_text_setup(void) {
***************
*** 11516,11520 ****
  
  /* should die: */
-     class_addmethod3(c,canvas_tidy,     "tidy","");
      class_addmethod3(c,canvas_texteditor,"texteditor","");
  /* end die */
--- 11361,11364 ----
***************
*** 11557,11561 ****
      class_addmethod3(c,canvas_object_moveto,"object_moveto","sff");
      class_addmethod3(c,canvas_object_delete,"object_delete","s");
!     class_addmethod3(c,canvas_object_delete,"object_insert","*");
      class_addmethod3(c,canvas_text_setto,"text_setto","*");
      class_setnotice(c, canvas_notice);
--- 11401,11405 ----
      class_addmethod3(c,canvas_object_moveto,"object_moveto","sff");
      class_addmethod3(c,canvas_object_delete,"object_delete","s");
!     class_addmethod3(c,canvas_object_insert,"object_insert","*");
      class_addmethod3(c,canvas_text_setto,"text_setto","*");
      class_setnotice(c, canvas_notice);





More information about the Pd-cvs mailing list