[PD-cvs] pd/src desire.c,1.1.2.30,1.1.2.31

Mathieu Bouchard matju at users.sourceforge.net
Wed Sep 28 10:32:18 CEST 2005


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

Modified Files:
      Tag: devel_0_39
	desire.c 
Log Message:
replaced some of get*arg by pd_scanargs.
also added "p" option in sys_mgui.


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.30
retrieving revision 1.1.2.31
diff -C2 -d -r1.1.2.30 -r1.1.2.31
*** desire.c	24 Sep 2005 22:32:35 -0000	1.1.2.30
--- desire.c	28 Sep 2005 08:32:16 -0000	1.1.2.31
***************
*** 332,352 ****
  
      if (argc == 5)  /* toplevel */
!     {
!         xloc = atom_getintarg(0, argc, argv);
!         yloc = atom_getintarg(1, argc, argv);
!         width = atom_getintarg(2, argc, argv);
!         height = atom_getintarg(3, argc, argv);
!         font = atom_getintarg(4, argc, argv);
!     }
      else if (argc == 6)  /* subwindow */
!     {
!         xloc = atom_getintarg(0, argc, argv);
!         yloc = atom_getintarg(1, argc, argv);
!         width = atom_getintarg(2, argc, argv);
!         height = atom_getintarg(3, argc, argv);
!         s = atom_getsymbolarg(4, argc, argv);
!         vis = atom_getintarg(5, argc, argv);
!     }
!         /* (otherwise assume we're being created from the menu.) */
  
      if (canvas_newdirectory->s_name[0])
--- 332,339 ----
  
      if (argc == 5)  /* toplevel */
! 	pd_scanargs(argc,argv,"iiiii",&xloc,&yloc,&width,&height,&font);
      else if (argc == 6)  /* subwindow */
! 	pd_scanargs(argc,argv,"iiiisi",&xloc,&yloc,&width,&height,&s,&vis);
!     /* (otherwise assume we're being created from the menu.) */
  
      if (canvas_newdirectory->s_name[0])
***************
*** 404,413 ****
  static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv)
  {
!     x->gl_x1 = atom_getfloatarg(0, argc, argv);
!     x->gl_y1 = atom_getfloatarg(1, argc, argv);
!     x->gl_x2 = atom_getfloatarg(2, argc, argv);
!     x->gl_y2 = atom_getfloatarg(3, argc, argv);
!     x->gl_pixwidth = atom_getintarg(4, argc, argv);
!     x->gl_pixheight = atom_getintarg(5, argc, argv);
      if (argc <= 7)
          canvas_setgraph(x, atom_getintarg(6, argc, argv), 1);
--- 391,396 ----
  static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv)
  {
!     pd_scanargs(argc,argv,"iiiiii;",&x->gl_x1,&x->gl_y1,&x->gl_x2,&x->gl_y2,
! 	&x->gl_pixwidth,&x->gl_pixheight);
      if (argc <= 7)
          canvas_setgraph(x, atom_getintarg(6, argc, argv), 1);
***************
*** 488,500 ****
  void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv)
  {
!     t_symbol *sym = atom_getsymbolarg(0, argc, argv);   
!     float x1 = atom_getfloatarg(1, argc, argv);  
!     float y1 = atom_getfloatarg(2, argc, argv);  
!     float x2 = atom_getfloatarg(3, argc, argv);  
!     float y2 = atom_getfloatarg(4, argc, argv);  
!     float px1 = atom_getfloatarg(5, argc, argv);  
!     float py1 = atom_getfloatarg(6, argc, argv);  
!     float px2 = atom_getfloatarg(7, argc, argv);  
!     float py2 = atom_getfloatarg(8, argc, argv);
      glist_addglist(g, sym, x1, y1, x2, y2, px1, py1, px2, py2);
  }
--- 471,477 ----
  void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv)
  {
!     t_symbol *sym;   
!     float x1,y1,x2,y2,px1,py1,px2,py2;
!     pd_scanargs(argc,argv,"sffffffff",&sym,&x1,&y1,&x2,&y2,&px1,&py1,&px2,&py2);
      glist_addglist(g, sym, x1, y1, x2, y2, px1, py1, px2, py2);
  }
***************
*** 637,651 ****
  }
  
! void canvas_redraw(t_canvas *x)
! {
!     if (glist_isvisible(x))
!     {
!         canvas_map(x, 0);
!         canvas_map(x, 1);
!     }
  }
  
- /* ----  editors -- perhaps this and "vis" should go to g_editor.c ------- */
- 
  static t_editor *editor_new(t_glist *owner)
  {
--- 614,621 ----
  }
  
! void canvas_redraw(t_canvas *x) {
!     if (glist_isvisible(x)) {canvas_map(x,0); canvas_map(x, 1);}
  }
  
  static t_editor *editor_new(t_glist *owner)
  {
***************
*** 2232,2301 ****
      /* called from the gui when "OK" is selected on the canvas properties
          dialog.  Again we negate "y" scale. */
! static void canvas_donecanvasdialog(t_glist *x,
!     t_symbol *s, int argc, t_atom *argv)
  {
- 
- 
      float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin; 
      int graphme, redraw = 0;
! 
!     xperpix = atom_getfloatarg(0, argc, argv);
!     yperpix = atom_getfloatarg(1, argc, argv);
!     graphme = (atom_getfloatarg(2, argc, argv) != 0);
!     x1 = atom_getfloatarg(3, argc, argv);
!     y1 = atom_getfloatarg(4, argc, argv);
!     x2 = atom_getfloatarg(5, argc, argv);
!     y2 = atom_getfloatarg(6, argc, argv);
!     xpix = atom_getfloatarg(7, argc, argv);
!     ypix = atom_getfloatarg(8, argc, argv);
!     xmargin = atom_getfloatarg(9, argc, argv);
!     ymargin = atom_getfloatarg(10, argc, argv);
!     
      x->gl_pixwidth = xpix;
      x->gl_pixheight = ypix;
      x->gl_xmargin = xmargin;
      x->gl_ymargin = ymargin;
- 
      yperpix = -yperpix;
!     if (xperpix == 0)
!         xperpix = 1;
!     if (yperpix == 0)
!         yperpix = 1;
! 
!     if (graphme)
!     {
!         if (x1 != x2)
!             x->gl_x1 = x1, x->gl_x2 = x2;
!         else x->gl_x1 = 0, x->gl_x2 = 1;
!         if (y1 != y2)
!             x->gl_y1 = y1, x->gl_y2 = y2;
!         else x->gl_y1 = 0, x->gl_y2 = 1;
!     }
!     else
!     {
          if (xperpix != glist_dpixtodx(x, 1) || yperpix != glist_dpixtody(x, 1))
              redraw = 1;
!         if (xperpix > 0)
!         {
              x->gl_x1 = 0;
              x->gl_x2 = xperpix;
!         }
!         else
!         {
              x->gl_x1 = -xperpix * (x->gl_screenx2 - x->gl_screenx1);
              x->gl_x2 = x->gl_x1 + xperpix;
          }
!         if (yperpix > 0)
!         {
              x->gl_y1 = 0;
              x->gl_y2 = yperpix;
!         }
!         else
!         {
              x->gl_y1 = -yperpix * (x->gl_screeny2 - x->gl_screeny1);
              x->gl_y2 = x->gl_y1 + yperpix;
          }
      }
!         /* LATER avoid doing 2 redraws here (possibly one inside setgraph) */
      canvas_setgraph(x, graphme, 0);
      if (x->gl_havewindow)
--- 2202,2244 ----
      /* called from the gui when "OK" is selected on the canvas properties
          dialog.  Again we negate "y" scale. */
! static void canvas_donecanvasdialog(t_glist *x, t_symbol *s, int argc, t_atom *argv)
  {
      float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin; 
      int graphme, redraw = 0;
!     pd_scanargs(argc,argv,"ffbffffffff",&xperpix,&yperpix,&graphme,
! 	&x1,&y1,&x2,&y2,&xpix,&ypix,&xmargin,&ymargin);
      x->gl_pixwidth = xpix;
      x->gl_pixheight = ypix;
      x->gl_xmargin = xmargin;
      x->gl_ymargin = ymargin;
      yperpix = -yperpix;
!     if (xperpix == 0) xperpix = 1;
!     if (yperpix == 0) yperpix = 1;
!     if (graphme) {
!         if (x1==x2) {x1=0;x2=1;}
! 	if (y1==y2) {y1=0;y2=1;}
! 	x->gl_x1 = x1;
! 	x->gl_x2 = x2;
! 	x->gl_y1 = y1;
! 	x->gl_y2 = y2;
!     } else {
          if (xperpix != glist_dpixtodx(x, 1) || yperpix != glist_dpixtody(x, 1))
              redraw = 1;
!         if (xperpix > 0) {
              x->gl_x1 = 0;
              x->gl_x2 = xperpix;
!         } else {
              x->gl_x1 = -xperpix * (x->gl_screenx2 - x->gl_screenx1);
              x->gl_x2 = x->gl_x1 + xperpix;
          }
!         if (yperpix > 0) {
              x->gl_y1 = 0;
              x->gl_y2 = yperpix;
!         } else {
              x->gl_y1 = -yperpix * (x->gl_screeny2 - x->gl_screeny1);
              x->gl_y2 = x->gl_y1 + yperpix;
          }
      }
! /* LATER avoid doing 2 redraws here (possibly one inside setgraph) */
      canvas_setgraph(x, graphme, 0);
      if (x->gl_havewindow)
***************
*** 5251,5255 ****
          y2->g_next = y;
      }
!     sys_vgui("%lx add %lx\n",(long)x,(long)y);
      /* voodoo */
      /* if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob); */
--- 5194,5198 ----
          y2->g_next = y;
      }
!     sys_mgui(x,"add","p",y);
      /* voodoo */
      /* if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob); */
***************
*** 12418,12421 ****
--- 12361,12365 ----
  		  case 'f': case 'd': i+=snprintf(buf+i,n-i," %f",va_arg(val,double)); break;
  		  case 'i': i+=snprintf(buf+i,n-i," %d",va_arg(val,int)); break;
+ 		  case 'p': i+=snprintf(buf+i,n-i," %lx",(long)va_arg(val,void*)); break;
  		  /*
  		  case 's': i+=snprintf(buf+i,n-i," \"%s\"",va_arg(val,t_symbol *)->s_name); break;





More information about the Pd-cvs mailing list