[PD-cvs] pd/src desire.c,1.1.2.217.2.89,1.1.2.217.2.90

Mathieu Bouchard matju at users.sourceforge.net
Wed Dec 20 06:26:41 CET 2006


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

Modified Files:
      Tag: desiredata
	desire.c 
Log Message:
the end of the code for [declare] (0.40)


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.89
retrieving revision 1.1.2.217.2.90
diff -C2 -d -r1.1.2.217.2.89 -r1.1.2.217.2.90
*** desire.c	20 Dec 2006 05:03:52 -0000	1.1.2.217.2.89
--- desire.c	20 Dec 2006 05:26:37 -0000	1.1.2.217.2.90
***************
*** 2618,2627 ****
  */
  
! /* this file reads and writes the "data" portions of a canvas to a file.
! See also canvas_saveto(), etc., in g_editor.c.  The data portion is a
! collection of "scalar" objects.  Routines here can save collections of
! scalars into a file and reload them; also, support is included here for
  */
  
  /* the following routines read "scalars" from a file into a canvas. */
  
--- 2618,2633 ----
  */
  
! /*
! Routines to read and write canvases to files:
! canvas_savetofile() writes a root canvas to a "pd" file.  (Reading "pd" files
! is done simply by passing the contents to the pd message interpreter.)
! Alternatively, the  glist_read() and glist_write() routines read and write
! "data" from and to files (reading reads into an existing canvas), using a
! file format as in the dialog window for data.
  */
  
+ static t_class *declare_class;
+ void canvas_savedeclarationsto(t_canvas *x, t_binbuf *b);
+ 
  /* the following routines read "scalars" from a file into a canvas. */
  
***************
*** 2991,3001 ****
     saves the document, and is only called on root canvases. */
  void canvas_savecontainerto(t_canvas *x, t_binbuf *b) {
      int x1=x->screenx1, xs=x->screenx2-x1;
      int y1=x->screeny1, ys=x->screeny2-y1;
      binbuf_addv(b, "ssiiii", gensym("#N"), gensym("canvas"), x1, y1, xs, ys);
      if (x->owner && !x->env) { /* subpatch */
! 	binbuf_addv(b, "si;", *x->name->s_name?x->name:gensym("(subpatch)"), x->mapped);
      } else { /* root or abstraction */
          binbuf_addv(b, "i;", (int)x->font);
      }
  }
--- 2997,3016 ----
     saves the document, and is only called on root canvases. */
  void canvas_savecontainerto(t_canvas *x, t_binbuf *b) {
+     /* have to go to original binbuf to find out how we were named. */
+     t_binbuf *bz = binbuf_new();
+     t_symbol *patchsym = &s_;
+     if (x->binbuf) {
+         binbuf_addbinbuf(bz, x->binbuf);
+         patchsym = atom_getsymbolarg(1, binbuf_getnatom(bz), binbuf_getvec(bz));
+         binbuf_free(bz);
+     }
      int x1=x->screenx1, xs=x->screenx2-x1;
      int y1=x->screeny1, ys=x->screeny2-y1;
      binbuf_addv(b, "ssiiii", gensym("#N"), gensym("canvas"), x1, y1, xs, ys);
      if (x->owner && !x->env) { /* subpatch */
! 	binbuf_addv(b, "si;", (patchsym != &s_ ? patchsym: gensym("(subpatch)")), x->mapped);
      } else { /* root or abstraction */
          binbuf_addv(b, "i;", (int)x->font);
+         canvas_savedeclarationsto(x, b);
      }
  }
***************
*** 3011,3015 ****
      binbuf_addv(b, "ssffffffi", gensym("#X"), gensym("coords"),
  	x->x1, x->y1, x->x2, x->y2, (float)x->pixwidth, (float)x->pixheight,
! 	x->isgraph);
      if (x->goprect) binbuf_addv(b, "ff", (float)x->xmargin, (float)x->ymargin);
      binbuf_addv(b,";");
--- 3026,3030 ----
      binbuf_addv(b, "ssffffffi", gensym("#X"), gensym("coords"),
  	x->x1, x->y1, x->x2, x->y2, (float)x->pixwidth, (float)x->pixheight,
! 	x->isgraph?x->hidetext?2:1:0);
      if (x->goprect) binbuf_addv(b, "ff", (float)x->xmargin, (float)x->ymargin);
      binbuf_addv(b,";");
***************
*** 7273,7278 ****
  before any objects are created in it. */
  
- static t_class *declare_class;
- 
  typedef struct _declare
  {
--- 7288,7291 ----





More information about the Pd-cvs mailing list