[PD-cvs] pd/src desire.c, 1.1.2.217.2.205, 1.1.2.217.2.206 desire.h, 1.1.2.49.2.40, 1.1.2.49.2.41

Mathieu Bouchard matju at users.sourceforge.net
Mon Aug 13 03:51:42 CEST 2007


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

Modified Files:
      Tag: desiredata
	desire.c desire.h 
Log Message:
canvas: rename "isgraph" to "gop"


Index: desire.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.h,v
retrieving revision 1.1.2.49.2.40
retrieving revision 1.1.2.49.2.41
diff -C2 -d -r1.1.2.49.2.40 -r1.1.2.49.2.41
*** desire.h	7 Aug 2007 18:46:40 -0000	1.1.2.49.2.40
--- desire.h	13 Aug 2007 01:51:39 -0000	1.1.2.49.2.41
***************
*** 170,174 ****
      unsigned int willvis:1;    /* make me visible after loading */
      unsigned int goprect:1;    /* draw rectangle for graph-on-parent */
!     unsigned int isgraph:1;    /* show as graph on parent */
      unsigned int hidetext:1;   /* hide object-name + args when doing graph on parent */
      long next_o_index;         /* next object index. to be incremented on each use */
--- 170,174 ----
      unsigned int willvis:1;    /* make me visible after loading */
      unsigned int goprect:1;    /* draw rectangle for graph-on-parent */
!     unsigned int gop:1;
      unsigned int hidetext:1;   /* hide object-name + args when doing graph on parent */
      long next_o_index;         /* next object index. to be incremented on each use */

Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.205
retrieving revision 1.1.2.217.2.206
diff -C2 -d -r1.1.2.217.2.205 -r1.1.2.217.2.206
*** desire.c	13 Aug 2007 00:01:49 -0000	1.1.2.217.2.205
--- desire.c	13 Aug 2007 01:51:36 -0000	1.1.2.217.2.206
***************
*** 600,604 ****
      if (x->name != s_Pd) pd_bind(x, canvas_makebindsym(x->name));
      x->owner = g;
!     x->isgraph = 1;
      x->goprect = 0;
      x->binbuf = binbuf_new();
--- 600,604 ----
      if (x->name != s_Pd) pd_bind(x, canvas_makebindsym(x->name));
      x->owner = g;
!     x->gop = 1;
      x->goprect = 0;
      x->binbuf = binbuf_new();
***************
*** 630,634 ****
      x->screenx1 = int(x1); x->screeny1 = int(y1);
      x->screenx2 = int(x2); x->screeny2 = int(y2);
!     if (!x->isgraph && x->y2 < x->y1) {
          /* if it's flipped so that y grows upward, fix so that zero is bottom edge and redraw.
  	   This is only appropriate if we're a regular "text" object on the parent. */
--- 630,634 ----
      x->screenx1 = int(x1); x->screeny1 = int(y1);
      x->screenx2 = int(x2); x->screeny2 = int(y2);
!     if (!x->gop && x->y2 < x->y1) {
          /* if it's flipped so that y grows upward, fix so that zero is bottom edge and redraw.
  	   This is only appropriate if we're a regular "text" object on the parent. */
***************
*** 680,684 ****
  /* 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 canvas_istoplevel(t_canvas *x) {return x->havewindow || !x->isgraph;}
  
  static int canvas_getfont(t_canvas *x) {
--- 680,684 ----
  /* 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 canvas_istoplevel(t_canvas *x) {return x->havewindow || !x->gop;}
  
  static int canvas_getfont(t_canvas *x) {
***************
*** 1110,1119 ****
     Set reasonable defaults for any missing paramters and redraw things if necessary. */
  void canvas_setgraph(t_canvas *x, int flag, int nogoprect) {
!     if (!flag && x->isgraph) {
!         x->isgraph = 0;
      } else if (flag) {
          if (x->pixwidth  <= 0) x->pixwidth  = CANVAS_DEFGRAPHWIDTH;
          if (x->pixheight <= 0) x->pixheight = CANVAS_DEFGRAPHHEIGHT;
!         SET(isgraph,1);
  	SET(hidetext,!!(flag&2));
          if (!nogoprect && !x->goprect) canvas_each(g,x) if (pd_checkobject(g)) {SET(goprect,1); break;}
--- 1110,1119 ----
     Set reasonable defaults for any missing paramters and redraw things if necessary. */
  void canvas_setgraph(t_canvas *x, int flag, int nogoprect) {
!     if (!flag && x->gop) {
!         x->gop = 0;
      } else if (flag) {
          if (x->pixwidth  <= 0) x->pixwidth  = CANVAS_DEFGRAPHWIDTH;
          if (x->pixheight <= 0) x->pixheight = CANVAS_DEFGRAPHHEIGHT;
!         SET(gop,1);
  	SET(hidetext,!!(flag&2));
          if (!nogoprect && !x->goprect) canvas_each(g,x) if (pd_checkobject(g)) {SET(goprect,1); break;}
***************
*** 1436,1440 ****
  static t_canvas *canvas_findgraph(t_canvas *x) {
      t_gobj *y = 0;
!     canvas_each(z,x) if (z->_class==canvas_class && ((t_canvas *)z)->isgraph) y = z;
      return (t_canvas *)y;
  }
--- 1436,1440 ----
  static t_canvas *canvas_findgraph(t_canvas *x) {
      t_gobj *y = 0;
!     canvas_each(z,x) if (z->_class==canvas_class && ((t_canvas *)z)->gop) y = z;
      return (t_canvas *)y;
  }
***************
*** 2025,2029 ****
      }
      gobj_changed(x,"children");
!     if (x->isgraph && !x->goprect && pd_checkobject(y)) SET(goprect,1);
      if (class_isdrawcommand(y->_class))
          canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(canvas_getcanvas(x)->name)), 0);
--- 2025,2029 ----
      }
      gobj_changed(x,"children");
!     if (x->gop && !x->goprect && pd_checkobject(y)) SET(goprect,1);
      if (class_isdrawcommand(y->_class))
          canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(canvas_getcanvas(x)->name)), 0);
***************
*** 2064,2068 ****
  
  t_canvas *canvas_getcanvas(t_canvas *x) {
!     while (x->owner && !x->havewindow && x->isgraph) x = x->owner;
      return x;
  }
--- 2064,2068 ----
  
  t_canvas *canvas_getcanvas(t_canvas *x) {
!     while (x->owner && !x->havewindow && x->gop) x = x->owner;
      return x;
  }
***************
*** 2211,2215 ****
  static float canvas_pixelstox(t_canvas *x, float xpix) {
      int x1, y1, x2, y2; float width = x->x2-x->x1;
!     if (!x->isgraph)   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);
--- 2211,2215 ----
  static float canvas_pixelstox(t_canvas *x, float xpix) {
      int x1, y1, x2, y2; float width = x->x2-x->x1;
!     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);
***************
*** 2218,2222 ****
  static float canvas_pixelstoy(t_canvas *x, float ypix) {
      int x1, y1, x2, y2; float height = x->y2-x->y1;
!     if (!x->isgraph)   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);
--- 2218,2222 ----
  static float canvas_pixelstoy(t_canvas *x, float ypix) {
      int x1, y1, x2, y2; float height = x->y2-x->y1;
!     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);
***************
*** 2227,2231 ****
  static int canvas_xtopixels(t_canvas *x, float xval) {
      int x1, y1, x2, y2; float width = x->x2-x->x1;
!     if (!x->isgraph) 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);
--- 2227,2231 ----
  static int canvas_xtopixels(t_canvas *x, float xval) {
      int x1, y1, x2, y2; float width = x->x2-x->x1;
!     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);
***************
*** 2234,2238 ****
  static int canvas_ytopixels(t_canvas *x, float yval) {
      int x1, y1, x2, y2; float height = x->y2-x->y1;
!     if (!x->isgraph) 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);
--- 2234,2238 ----
  static int canvas_ytopixels(t_canvas *x, float yval) {
      int x1, y1, x2, y2; float height = x->y2-x->y1;
!     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);
***************
*** 2246,2250 ****
  static int text_xpix(t_text *x, t_canvas *canvas) {
      float width = canvas->x2-canvas->x1;
!     if (canvas->havewindow || !canvas->isgraph) return x->x;
      if (canvas->goprect) return canvas->x+x->x-canvas->xmargin;
      return canvas_xtopixels(canvas, canvas->x1 + width * x->x / (canvas->screenx2-canvas->screenx1));
--- 2246,2250 ----
  static int text_xpix(t_text *x, t_canvas *canvas) {
      float width = canvas->x2-canvas->x1;
!     if (canvas->havewindow || !canvas->gop) return x->x;
      if (canvas->goprect) return canvas->x+x->x-canvas->xmargin;
      return canvas_xtopixels(canvas, canvas->x1 + width * x->x / (canvas->screenx2-canvas->screenx1));
***************
*** 2252,2256 ****
  static int text_ypix(t_text *x, t_canvas *canvas) {
      float height = canvas->y2-canvas->y1;
!     if (canvas->havewindow || !canvas->isgraph) return x->y;
      if (canvas->goprect) return canvas->y+x->y-canvas->ymargin;
      return canvas_ytopixels(canvas, canvas->y1 + height* x->y / (canvas->screeny2-canvas->screeny1));
--- 2252,2256 ----
  static int text_ypix(t_text *x, t_canvas *canvas) {
      float height = canvas->y2-canvas->y1;
!     if (canvas->havewindow || !canvas->gop) return x->y;
      if (canvas->goprect) return canvas->y+x->y-canvas->ymargin;
      return canvas_ytopixels(canvas, canvas->y1 + height* x->y / (canvas->screeny2-canvas->screeny1));
***************
*** 2738,2747 ****
  static void canvas_savecoordsto(t_canvas *x, t_binbuf *b) {
      /* if everything is the default, skip saving this line */
!     if (!x->isgraph && x->x1==0 && x->y1==0 && x->x2==1 && x->y2==1 && x->pixwidth==0 && x->pixheight==0) return;
      /* if we have a graph-on-parent rectangle, we're new style. The format is arranged so
         that old versions of Pd can at least do something with it.
         otherwise write in 0.38-compatible form. */
!     binbuf_addv(b,"ttffffffi","#X","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,";");
--- 2738,2746 ----
  static void canvas_savecoordsto(t_canvas *x, t_binbuf *b) {
      /* if everything is the default, skip saving this line */
!     if (!x->gop && x->x1==0 && x->y1==0 && x->x2==1 && x->y2==1 && x->pixwidth==0 && x->pixheight==0) return;
      /* if we have a graph-on-parent rectangle, we're new style. The format is arranged so
         that old versions of Pd can at least do something with it.
         otherwise write in 0.38-compatible form. */
!     binbuf_addv(b,"ttffffffi","#X","coords", x->x1,x->y1,x->x2,x->y2, (float)x->pixwidth,(float)x->pixheight, x->gop?x->hidetext?2:1:0);
      if (x->goprect) binbuf_addv(b, "ff", (float)x->xmargin, (float)x->ymargin);
      binbuf_addv(b,";");





More information about the Pd-cvs mailing list