[PD-cvs] pd/src desire.c, 1.1.2.217.2.227, 1.1.2.217.2.228 desire.h, 1.1.2.49.2.51, 1.1.2.49.2.52

Mathieu Bouchard matju at users.sourceforge.net
Sun Aug 19 04:35:29 CEST 2007


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

Modified Files:
      Tag: desiredata
	desire.c desire.h 
Log Message:
removed canvas field "owner" (duplicate of "dix->canvas")


Index: desire.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.h,v
retrieving revision 1.1.2.49.2.51
retrieving revision 1.1.2.49.2.52
diff -C2 -d -r1.1.2.49.2.51 -r1.1.2.49.2.52
*** desire.h	18 Aug 2007 05:44:25 -0000	1.1.2.49.2.51
--- desire.h	19 Aug 2007 02:35:27 -0000	1.1.2.49.2.52
***************
*** 156,160 ****
      t_object gl_obj;         /* header in case we're a [pd] or abstraction */
  #endif
-     t_canvas *owner;         /* parent canvas, supercanvas, or 0 if none */
      int pixwidth, pixheight; /* width in pixels (on parent, if a graph) */
      float x1,y1,x2,y2;       /* bounding rectangle in our own coordinates */
--- 156,159 ----

Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.227
retrieving revision 1.1.2.217.2.228
diff -C2 -d -r1.1.2.217.2.227 -r1.1.2.217.2.228
*** desire.c	19 Aug 2007 01:17:17 -0000	1.1.2.217.2.227
--- desire.c	19 Aug 2007 02:35:24 -0000	1.1.2.217.2.228
***************
*** 117,120 ****
--- 117,133 ----
  
  //--------------------------------------------------------------------------
+ 
+ t_class *gop_filtre_class;
+ 
+ struct t_gop_filtre : t_gobj {
+ };
+ 
+ t_gobj *gop_filtre_new() {
+ 	t_gop_filtre *self = (t_gop_filtre *)pd_new(gop_filtre_class);
+ 	new(self) t_gop_filtre;
+ 	return self;
+ }
+ 
+ //--------------------------------------------------------------------------
  // t_appendix: an extension to t_gobj made by matju so that all t_gobj's may have new fields
  // without sacrificing binary compat with externals compiled for PureMSP.
***************
*** 443,451 ****
  
  t_canvasenvironment *canvas_getenv(t_canvas *x) {
!     if (!x) bug("canvas_getenv");
!     while (!x->env) {
! 	x = x->owner;
!         if (!x) {bug("t_canvasenvironment", x); return 0;}
!     }
      return x->env;
  }
--- 456,460 ----
  
  t_canvasenvironment *canvas_getenv(t_canvas *x) {
!     while (!x->env) x = x->dix->canvas;
      return x->env;
  }
***************
*** 578,582 ****
      x->x2 = 1; x->y2 = 1;
      canvas_setbounds(x, xloc, yloc, xloc + width, yloc + height);
!     x->owner = owner;
      x->name = *s->name ? s : canvas_newfilename ? canvas_newfilename : s_Pd;
      if (x->name != s_Pd) pd_bind(x, canvas_makebindsym(x->name));
--- 587,591 ----
      x->x2 = 1; x->y2 = 1;
      canvas_setbounds(x, xloc, yloc, xloc + width, yloc + height);
!     gobj_setcanvas(x,owner);
      x->name = *s->name ? s : canvas_newfilename ? canvas_newfilename : s_Pd;
      if (x->name != s_Pd) pd_bind(x, canvas_makebindsym(x->name));
***************
*** 586,591 ****
      if (vis && gensym("#X")->thing && gensym("#X")->thing->_class == canvas_class) {
          t_canvas *z = (t_canvas *)(gensym("#X")->thing);
!         while (z && !z->env) z = z->owner;
!         if (z && canvas_isabstraction(z) && z->owner) vis = 0;
      }
      if (vis) canvas_vis(x,vis);
--- 595,600 ----
      if (vis && gensym("#X")->thing && gensym("#X")->thing->_class == canvas_class) {
          t_canvas *z = (t_canvas *)(gensym("#X")->thing);
!         while (z && !z->env) z = z->dix->canvas;
!         if (z && canvas_isabstraction(z) && z->dix->canvas) vis = 0;
      }
      if (vis) canvas_vis(x,vis);
***************
*** 642,646 ****
      x->screenx1 = x->screeny1 = 0; x->screenx2 = 450; x->screeny2 = 300;
      if (x->name != s_Pd) pd_bind(x, canvas_makebindsym(x->name));
!     x->owner = g;
      x->gop = 1;
      x->goprect = 0;
--- 651,655 ----
      x->screenx1 = x->screeny1 = 0; x->screenx2 = 450; x->screeny2 = 300;
      if (x->name != s_Pd) pd_bind(x, canvas_makebindsym(x->name));
!     gobj_setcanvas(x,g);
      x->gop = 1;
      x->goprect = 0;
***************
*** 693,697 ****
  static void canvas_menu_open(t_canvas *x) {
      if (canvas_isvisible(x) && !canvas_istoplevel(x)) {
!         if (!x->owner) {error("can't open a non-subcanvas"); return;}
          SET(havewindow,1);
      }
--- 702,706 ----
  static void canvas_menu_open(t_canvas *x) {
      if (canvas_isvisible(x) && !canvas_istoplevel(x)) {
!         if (!x->dix->canvas) {error("this works only on subpatch or abstraction"); return;}
          SET(havewindow,1);
      }
***************
*** 704,712 ****
  int canvas_istoplevel(t_canvas *x) {return x->havewindow || !x->gop;}
  
- static int canvas_getfont(t_canvas *x) {
-     while (!x->env) x=x->owner;
-     return x->font;
- }
- 
  static void canvas_free(t_canvas *x) {
      int dspstate = canvas_suspend_dsp();
--- 713,716 ----
***************
*** 723,727 ****
      free(x->xlabel);
      free(x->ylabel);
!     if (!x->owner) canvas_takeofflist(x);
  }
  
--- 727,731 ----
      free(x->xlabel);
      free(x->ylabel);
!     if (!x->dix->canvas) canvas_takeofflist(x);
  }
  
***************
*** 767,771 ****
      if (!z) {error("out of context"); return;}
      if (z->_class != canvas_class) {error("wasn't a canvas"); return;}
!     x->owner = (t_canvas *)z;
      canvas_objfor((t_canvas *)z, x, argc, argv);
      newest = x;
--- 771,775 ----
      if (!z) {error("out of context"); return;}
      if (z->_class != canvas_class) {error("wasn't a canvas"); return;}
!     gobj_setcanvas(x,(t_canvas *)z);
      canvas_objfor((t_canvas *)z, x, argc, argv);
      newest = x;
***************
*** 829,833 ****
      SETFLOAT(a+5, 1);
      t_canvas *x = canvas_new(0, 0, 6, a);
!     x->owner = z;
      canvas_pop(x, 1);
      return x;
--- 833,837 ----
      SETFLOAT(a+5, 1);
      t_canvas *x = canvas_new(0, 0, 6, a);
!     gobj_setcanvas(x,z);
      canvas_pop(x, 1);
      return x;
***************
*** 862,866 ****
      SETFLOAT(a+5, 0);
      t_canvas *x = canvas_new(0,0,6,a);
!     x->owner = z;
      /* create a graph for the table */
      t_canvas *gl = canvas_addcanvas(x, &s_, 0, -1, (f > 1 ? f-1 : 1), 1, 50, 350, 550, 50);
--- 866,870 ----
      SETFLOAT(a+5, 0);
      t_canvas *x = canvas_new(0,0,6,a);
!     gobj_setcanvas(x,z);
      /* create a graph for the table */
      t_canvas *gl = canvas_addcanvas(x, &s_, 0, -1, (f > 1 ? f-1 : 1), 1, 50, 350, 550, 50);
***************
*** 892,897 ****
  /* get the document containing this canvas */
  t_canvas *canvas_getrootfor(t_canvas *x) {
!     if (!x->owner || canvas_isabstraction(x)) return x;
!     return canvas_getrootfor(x->owner);
  }
  
--- 896,901 ----
  /* get the document containing this canvas */
  t_canvas *canvas_getrootfor(t_canvas *x) {
!     if (!x->dix->canvas || canvas_isabstraction(x)) return x;
!     return canvas_getrootfor(x->dix->canvas);
  }
  
***************
*** 975,979 ****
      void *ret = 0;
      canvas_each(g,canvas) if (g->_class == blockclass) ret = g;
!     *canvasp = canvas->owner;
      return ret;
  }
--- 979,983 ----
      void *ret = 0;
      canvas_each(g,canvas) if (g->_class == blockclass) ret = g;
!     *canvasp = canvas->dix->canvas;
      return ret;
  }
***************
*** 1120,1124 ****
  
  void canvas_close(t_canvas *x) {
!     if (x->owner) canvas_vis(x, 0); else pd_free(x);
  }
  
--- 1124,1128 ----
  
  void canvas_close(t_canvas *x) {
!     if (x->dix->canvas) canvas_vis(x, 0); else pd_free(x);
  }
  
***************
*** 1157,1161 ****
  
  static void canvas_find_parent(t_canvas *x) {
!     if (x->owner) canvas_vis(canvas_getcanvas(x->owner), 1);
  }
  
--- 1161,1165 ----
  
  static void canvas_find_parent(t_canvas *x) {
!     if (x->dix->canvas) canvas_vis(canvas_getcanvas(x->dix->canvas), 1);
  }
  
***************
*** 2027,2032 ****
  }
  
  t_canvas *canvas_getcanvas(t_canvas *x) {
!     while (x->owner && !x->havewindow && x->gop) x = x->owner;
      return x;
  }
--- 2031,2037 ----
  }
  
+ 
  t_canvas *canvas_getcanvas(t_canvas *x) {
!     while (x->dix->canvas && !x->havewindow && x->gop) x = x->dix->canvas;
      return x;
  }
***************
*** 2104,2112 ****
  
  static void canvas_rminlet(t_canvas *x, t_inlet *ip) {
!     if (x->owner) canvas_deletelinesforio(x->owner,x,ip,0);
      inlet_free(ip); /*gobj_changed(x,0);*/
  }
  static void canvas_rmoutlet(t_canvas *x, t_outlet *op) {
!     if (x->owner) canvas_deletelinesforio(x->owner,x,0,op);
      outlet_free(op); /*gobj_changed(x,0);*/
  }
--- 2109,2117 ----
  
  static void canvas_rminlet(t_canvas *x, t_inlet *ip) {
!     if (x->dix->canvas) canvas_deletelinesforio(x->dix->canvas,x,ip,0);
      inlet_free(ip); /*gobj_changed(x,0);*/
  }
  static void canvas_rmoutlet(t_canvas *x, t_outlet *op) {
!     if (x->dix->canvas) canvas_deletelinesforio(x->dix->canvas,x,0,op);
      outlet_free(op); /*gobj_changed(x,0);*/
  }
***************
*** 2182,2186 ****
      if (!x->gop)       return x->x1 + width * xpix;
      if (x->havewindow) return x->x1 + width * xpix / (x->screenx2-x->screenx1);
!     graph_graphrect(x, x->owner, &x1, &y1, &x2, &y2);
      return x->x1 + width * (xpix-x1) / (x2-x1);
  }
--- 2187,2191 ----
      if (!x->gop)       return x->x1 + width * xpix;
      if (x->havewindow) return x->x1 + width * xpix / (x->screenx2-x->screenx1);
!     graph_graphrect(x, x->dix->canvas, &x1, &y1, &x2, &y2);
      return x->x1 + width * (xpix-x1) / (x2-x1);
  }
***************
*** 2189,2193 ****
      if (!x->gop)       return x->y1 + height * ypix;
      if (x->havewindow) return x->y1 + height * ypix / (x->screeny2-x->screeny1);
!     graph_graphrect(x, x->owner, &x1, &y1, &x2, &y2);
      return x->y1 + height * (ypix-y1) / (y2-y1);
  }
--- 2194,2198 ----
      if (!x->gop)       return x->y1 + height * ypix;
      if (x->havewindow) return x->y1 + height * ypix / (x->screeny2-x->screeny1);
!     graph_graphrect(x, x->dix->canvas, &x1, &y1, &x2, &y2);
      return x->y1 + height * (ypix-y1) / (y2-y1);
  }
***************
*** 2198,2202 ****
      if (!x->gop)       return int((xval-x->x1)/width);
      if (x->havewindow) return int((x->screenx2-x->screenx1) * (xval-x->x1) / width);
!     graph_graphrect(x, x->owner, &x1, &y1, &x2, &y2);
      return int(x1 + (x2-x1) * (xval-x->x1) / width);
  }
--- 2203,2207 ----
      if (!x->gop)       return int((xval-x->x1)/width);
      if (x->havewindow) return int((x->screenx2-x->screenx1) * (xval-x->x1) / width);
!     graph_graphrect(x, x->dix->canvas, &x1, &y1, &x2, &y2);
      return int(x1 + (x2-x1) * (xval-x->x1) / width);
  }
***************
*** 2205,2209 ****
      if (!x->gop)       return int((yval-x->y1)/height);
      if (x->havewindow) return int((x->screeny2-x->screeny1) * (yval-x->y1) / height);
!     graph_graphrect(x, x->owner, &x1, &y1, &x2, &y2);
      return int(y1 + (y2-y1) * (yval-x->y1) / height);
  }
--- 2210,2214 ----
      if (!x->gop)       return int((yval-x->y1)/height);
      if (x->havewindow) return int((x->screeny2-x->screeny1) * (yval-x->y1) / height);
!     graph_graphrect(x, x->dix->canvas, &x1, &y1, &x2, &y2);
      return int(y1 + (y2-y1) * (yval-x->y1) / height);
  }
***************
*** 2232,2236 ****
  static void graph_vis(t_gobj *gr, int vis) {
  	t_canvas *x = (t_canvas *)gr;
! 	t_canvas *c = canvas_getcanvas(x->owner);
  	char tag[50];
  	int x1=69, y1=69, x2=69, y2=69;
--- 2237,2241 ----
  static void graph_vis(t_gobj *gr, int vis) {
  	t_canvas *x = (t_canvas *)gr;
! 	t_canvas *c = canvas_getcanvas(x->dix->canvas);
  	char tag[50];
  	int x1=69, y1=69, x2=69, y2=69;
***************
*** 2297,2301 ****
      /* draw labels */
  	#define DRAWLABEL(x1,y1) sys_vgui(".x%lx.c create text %d %d -text {%s} -font "FONT" -tags %s\n", (long)c, \
! 		int(canvas_xtopixels(x,x1)),int(canvas_ytopixels(x,y1)),s,canvas_getfont(x),tag);
          for (int i=0; i < x->nxlabels; i++) {char *s = x->xlabel[i]->name; DRAWLABEL(atof(s),x->xlabely);}
          for (int i=0; i < x->nylabels; i++) {char *s = x->ylabel[i]->name; DRAWLABEL(x->ylabelx,atof(s));}
--- 2302,2306 ----
      /* draw labels */
  	#define DRAWLABEL(x1,y1) sys_vgui(".x%lx.c create text %d %d -text {%s} -font "FONT" -tags %s\n", (long)c, \
! 		int(canvas_xtopixels(x,x1)),int(canvas_ytopixels(x,y1)),s,42,tag);
          for (int i=0; i < x->nxlabels; i++) {char *s = x->xlabel[i]->name; DRAWLABEL(atof(s),x->xlabely);}
          for (int i=0; i < x->nylabels; i++) {char *s = x->ylabel[i]->name; DRAWLABEL(x->ylabelx,atof(s));}
***************
*** 2661,2665 ****
      int y1=x->screeny1, ys=x->screeny2-y1;
      binbuf_addv(b,"ttiiii","#N","canvas",x1,y1,xs,ys);
!     if (x->owner && !x->env) { /* subpatch */
  	binbuf_addv(b, "si;", (patchsym != &s_ ? patchsym: gensym("(subpatch)")), x->havewindow);
      } else { /* root or abstraction */
--- 2666,2670 ----
      int y1=x->screeny1, ys=x->screeny2-y1;
      binbuf_addv(b,"ttiiii","#N","canvas",x1,y1,xs,ys);
!     if (x->dix->canvas && !x->env) { /* subpatch */
  	binbuf_addv(b, "si;", (patchsym != &s_ ? patchsym: gensym("(subpatch)")), x->havewindow);
      } else { /* root or abstraction */
***************
*** 2748,2752 ****
      if (!binbuf_write(b, filename->name, dir->name, 0)) {
  	/* if not an abstraction, reset title bar and directory */
!         if (!x->owner) canvas_rename(x, filename, dir);
          post("saved to: %s/%s", dir->name, filename->name);
          canvas_reload(filename,dir,x);
--- 2753,2757 ----
      if (!binbuf_write(b, filename->name, dir->name, 0)) {
  	/* if not an abstraction, reset title bar and directory */
!         if (!x->dix->canvas) canvas_rename(x, filename, dir);
          post("saved to: %s/%s", dir->name, filename->name);
          canvas_reload(filename,dir,x);
***************
*** 6702,6708 ****
      if (sys_open_absolute(name, ext, dirresult, nameresult, bin, &fd)) return fd;
      /* otherwise "name" is relative; start trying in directories named in this and parent environments */
!     for (t_canvas *y=x; y; y = y->owner) if (y->env) {
          t_canvas *x2 = x;
!         while (x2 && x2->owner) x2 = x2->owner;
          const char *dir = x2 ? canvas_getdir(x2)->name : ".";
          for (t_namelist *nl = y->env->path; nl; nl = nl->nl_next) {
--- 6707,6713 ----
      if (sys_open_absolute(name, ext, dirresult, nameresult, bin, &fd)) return fd;
      /* otherwise "name" is relative; start trying in directories named in this and parent environments */
!     for (t_canvas *y=x; y; y = y->dix->canvas) if (y->env) {
          t_canvas *x2 = x;
!         while (x2 && x2->dix->canvas) x2 = x2->dix->canvas;
          const char *dir = x2 ? canvas_getdir(x2)->name : ".";
          for (t_namelist *nl = y->env->path; nl; nl = nl->nl_next) {





More information about the Pd-cvs mailing list