[PD-cvs] externals/unauthorized/scratcher~ CHANGES.LOG,1.2,1.3 Makefile,1.1,1.2 scratcher~.c,1.8,1.9

Yves Degoyon sevyves at users.sourceforge.net
Wed Mar 2 03:48:26 CET 2005


Update of /cvsroot/pure-data/externals/unauthorized/scratcher~
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6021

Modified Files:
	CHANGES.LOG Makefile scratcher~.c 
Log Message:
Added GOP supoort

Index: CHANGES.LOG
===================================================================
RCS file: /cvsroot/pure-data/externals/unauthorized/scratcher~/CHANGES.LOG,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CHANGES.LOG	17 Sep 2003 20:55:06 -0000	1.2
--- CHANGES.LOG	2 Mar 2005 02:48:23 -0000	1.3
***************
*** 1,2 ****
--- 1,6 ----
+ 0.9
+   added GOP support
+ 0.8
+   adapted for pd 0.37
  0.7
    fixed more crashes in carmona

Index: scratcher~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/unauthorized/scratcher~/scratcher~.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** scratcher~.c	30 May 2004 05:20:01 -0000	1.8
--- scratcher~.c	2 Mar 2005 02:48:23 -0000	1.9
***************
*** 38,44 ****
  #include <fcntl.h>
  #include <sys/stat.h>
- #ifndef MACOSX
  #include <malloc.h>
- #endif
  #include <ctype.h>
  #include <pthread.h>
--- 38,42 ----
***************
*** 49,58 ****
  #endif
  #ifdef NT
! #include <winsock2.h>
! #include <sys/timeb.h>
  #endif
  #include <math.h>
  
! #include <m_pd.h>
  #include "m_imp.h"
  #include "g_canvas.h"
--- 47,55 ----
  #endif
  #ifdef NT
! #define M_PI 3.14159265358979323846
  #endif
  #include <math.h>
  
! #include "m_pd.h"
  #include "m_imp.h"
  #include "g_canvas.h"
***************
*** 114,118 ****
  #define SCRATCHER_MOVE_TIMEOUT 20
  
! static char   *scratcher_version = "scratcher~: version 0.7, written by Yves Degoyon (ydegoyon at free.fr)";
  
  static t_class *scratcher_class;
--- 111,115 ----
  #define SCRATCHER_MOVE_TIMEOUT 20
  
! static char   *scratcher_version = "scratcher~: version 0.9, written by Yves Degoyon (ydegoyon at free.fr)";
  
  static t_class *scratcher_class;
***************
*** 160,174 ****
  
      SYS_VGUI7(".x%x.c create oval %d %d %d %d -fill #000000 -tags %xSCRATCHER\n",
! 	     canvas, x->x_obj.te_xpix, x->x_obj.te_ypix,
! 	     x->x_obj.te_xpix + x->x_width, 
!              x->x_obj.te_ypix + x->x_height,
  	     x);
      for ( ci=0; ci<SCRATCHER_NB_GROOVES; ci ++)
      {
        SYS_VGUI8(".x%x.c create oval %d %d %d %d -outline #FFFFFF -tags %xGROOVE%d\n",
! 	     canvas, x->x_obj.te_xpix + ci*x->x_width/(2*SCRATCHER_NB_GROOVES), 
!              x->x_obj.te_ypix + ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
! 	     x->x_obj.te_xpix + x->x_width - ci*x->x_width/(2*SCRATCHER_NB_GROOVES), 
!              x->x_obj.te_ypix + x->x_height - ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
  	     x, ci);
      }
--- 157,171 ----
  
      SYS_VGUI7(".x%x.c create oval %d %d %d %d -fill #000000 -tags %xSCRATCHER\n",
! 	     canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
! 	     text_xpix(&x->x_obj, glist) + x->x_width, 
!              text_ypix(&x->x_obj, glist) + x->x_height,
  	     x);
      for ( ci=0; ci<SCRATCHER_NB_GROOVES; ci ++)
      {
        SYS_VGUI8(".x%x.c create oval %d %d %d %d -outline #FFFFFF -tags %xGROOVE%d\n",
! 	     canvas, text_xpix(&x->x_obj, glist) + ci*x->x_width/(2*SCRATCHER_NB_GROOVES), 
!              text_ypix(&x->x_obj, glist) + ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
! 	     text_xpix(&x->x_obj, glist) + x->x_width - ci*x->x_width/(2*SCRATCHER_NB_GROOVES), 
!              text_ypix(&x->x_obj, glist) + x->x_height - ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
  	     x, ci);
      }
***************
*** 176,189 ****
      {
         SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
!                canvas, x->x_obj.te_xpix+x->x_width/2,
!                x->x_obj.te_ypix+x->x_height/2,
!                x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
!                x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )), 
                 x );
      }
      SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -tags %xFSCRATCHER\n",
! 	     canvas, x->x_obj.te_xpix, x->x_obj.te_ypix,
! 	     x->x_obj.te_xpix + x->x_width, 
!              x->x_obj.te_ypix + x->x_height,
  	     x);
      canvas_fixlinesfor( canvas, (t_text*)x );
--- 173,186 ----
      {
         SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
!                canvas, text_xpix(&x->x_obj, glist)+x->x_width/2,
!                text_ypix(&x->x_obj, glist)+x->x_height/2,
!                text_xpix(&x->x_obj, glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
!                text_ypix(&x->x_obj, glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )), 
                 x );
      }
      SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -tags %xFSCRATCHER\n",
! 	     canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
! 	     text_xpix(&x->x_obj, glist) + x->x_width, 
!              text_ypix(&x->x_obj, glist) + x->x_height,
  	     x);
      canvas_fixlinesfor( canvas, (t_text*)x );
***************
*** 193,205 ****
  {
    t_int ci;
  
      if ( glist_isvisible( glist ) )
      {
!        SYS_VGUI3( ".x%x.c delete %xSCRATCHER\n", glist_getcanvas( glist ), x );
!        SYS_VGUI3( ".x%x.c delete %xFSCRATCHER\n", glist_getcanvas( glist ), x );
!        SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", glist_getcanvas( glist ), x );
         for ( ci=0; ci<SCRATCHER_NB_GROOVES; ci ++)
         {
!           SYS_VGUI4( ".x%x.c delete %xGROOVE%d\n", glist_getcanvas( glist ), x, ci );
         }
      }
--- 190,203 ----
  {
    t_int ci;
+   t_canvas *canvas=glist_getcanvas(glist);
  
      if ( glist_isvisible( glist ) )
      {
!        SYS_VGUI3( ".x%x.c delete %xSCRATCHER\n", canvas, x );
!        SYS_VGUI3( ".x%x.c delete %xFSCRATCHER\n", canvas, x );
!        SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", canvas, x );
         for ( ci=0; ci<SCRATCHER_NB_GROOVES; ci ++)
         {
!           SYS_VGUI4( ".x%x.c delete %xGROOVE%d\n", canvas, x, ci );
         }
      }
***************
*** 215,234 ****
      SYS_VGUI7(".x%x.c coords %xSCRATCHER %d %d %d %d\n",
  	     canvas, x,
! 	     x->x_obj.te_xpix-1, x->x_obj.te_ypix-1,
! 	     x->x_obj.te_xpix+x->x_width+1, 
!              x->x_obj.te_ypix+x->x_height+1);
      SYS_VGUI7(".x%x.c coords %xFSCRATCHER %d %d %d %d\n",
  	     canvas, x,
! 	     x->x_obj.te_xpix-1, x->x_obj.te_ypix-1,
! 	     x->x_obj.te_xpix+x->x_width+1, 
!              x->x_obj.te_ypix+x->x_height+1);
      if ( x->x_showspeed )
      {
         SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
                 canvas, x,
!                x->x_obj.te_xpix+x->x_width/2,
!                x->x_obj.te_ypix+x->x_height/2,
!                x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
!                x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                 );
      }
--- 213,232 ----
      SYS_VGUI7(".x%x.c coords %xSCRATCHER %d %d %d %d\n",
  	     canvas, x,
! 	     text_xpix(&x->x_obj, glist)-1, text_ypix(&x->x_obj, glist)-1,
! 	     text_xpix(&x->x_obj, glist)+x->x_width+1, 
!              text_ypix(&x->x_obj, glist)+x->x_height+1);
      SYS_VGUI7(".x%x.c coords %xFSCRATCHER %d %d %d %d\n",
  	     canvas, x,
! 	     text_xpix(&x->x_obj, glist)-1, text_ypix(&x->x_obj, glist)-1,
! 	     text_xpix(&x->x_obj, glist)+x->x_width+1, 
!              text_ypix(&x->x_obj, glist)+x->x_height+1);
      if ( x->x_showspeed )
      {
         SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
                 canvas, x,
!                text_xpix(&x->x_obj, glist)+x->x_width/2,
!                text_ypix(&x->x_obj, glist)+x->x_height/2,
!                text_xpix(&x->x_obj, glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
!                text_ypix(&x->x_obj, glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                 );
      }
***************
*** 237,244 ****
        SYS_VGUI8(".x%x.c coords %xGROOVE%d %d %d %d %d\n",
  	     canvas, x, ci,
!              x->x_obj.te_xpix + ci*x->x_width/(2*SCRATCHER_NB_GROOVES), 
!              x->x_obj.te_ypix + ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
! 	     x->x_obj.te_xpix + x->x_width - ci*x->x_width/(2*SCRATCHER_NB_GROOVES), 
!              x->x_obj.te_ypix + x->x_height - ci*x->x_height/(2*SCRATCHER_NB_GROOVES)
  	     );
      }
--- 235,242 ----
        SYS_VGUI8(".x%x.c coords %xGROOVE%d %d %d %d %d\n",
  	     canvas, x, ci,
!              text_xpix(&x->x_obj, glist) + ci*x->x_width/(2*SCRATCHER_NB_GROOVES), 
!              text_ypix(&x->x_obj, glist) + ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
! 	     text_xpix(&x->x_obj, glist) + x->x_width - ci*x->x_width/(2*SCRATCHER_NB_GROOVES), 
!              text_ypix(&x->x_obj, glist) + x->x_height - ci*x->x_height/(2*SCRATCHER_NB_GROOVES)
  	     );
      }
***************
*** 270,277 ****
     t_scratcher* x = (t_scratcher*)z;
  
!    *xp1 = x->x_obj.te_xpix;
!    *yp1 = x->x_obj.te_ypix;
!    *xp2 = x->x_obj.te_xpix+x->x_width;
!    *yp2 = x->x_obj.te_ypix+x->x_height;
  }
  
--- 268,275 ----
     t_scratcher* x = (t_scratcher*)z;
  
!    *xp1 = text_xpix(&x->x_obj, owner);
!    *yp1 = text_ypix(&x->x_obj, owner);
!    *xp2 = text_xpix(&x->x_obj, owner)+x->x_width;
!    *yp2 = text_ypix(&x->x_obj, owner)+x->x_height;
  }
  
***************
*** 281,285 ****
  
     binbuf_addv(b, "ssiisiiiiff", gensym("#X"),gensym("obj"),
! 		(t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
  		gensym("scratcher~"), x->x_size, x->x_width, x->x_height, 
                  x->x_sensibility, x->x_maxspeed, x->x_inertia );
--- 279,283 ----
  
     binbuf_addv(b, "ssiisiiiiff", gensym("#X"),gensym("obj"),
! 		(t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist),
  		gensym("scratcher~"), x->x_size, x->x_width, x->x_height, 
                  x->x_sensibility, x->x_maxspeed, x->x_inertia );
***************
*** 327,337 ****
  static void scratcher_motion(t_scratcher *x, t_floatarg dx, t_floatarg dy)
  {
- #ifdef NT
-     time_t et;
-     struct _timeb tv;
- #else
    struct timeval tv;
    struct timezone tz;
! #endif
  
     // post( "scratcher_motion dx=%f dy=%f", dx, dy );
--- 325,331 ----
  static void scratcher_motion(t_scratcher *x, t_floatarg dx, t_floatarg dy)
  {
    struct timeval tv;
    struct timezone tz;
!   t_canvas *canvas=glist_getcanvas(x->x_glist);
  
     // post( "scratcher_motion dx=%f dy=%f", dx, dy );
***************
*** 341,352 ****
     x->x_mousemoved = 1;
     // get current time in ms
- #ifdef NT
-       time( &et );
-       _ftime( &tv );
-       x->x_lastmovetime = et*1000 + tv.millitm;
- #else
     gettimeofday( &tv, &tz );
     x->x_lastmovetime = tv.tv_sec*1000 + tv.tv_usec/1000;
- #endif
     // post( "scratcher~ : move time : %ld", x->x_lastmovetime );
  
--- 335,340 ----
***************
*** 354,362 ****
     {
        SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
!               glist_getcanvas( x->x_glist ), x,
!               x->x_obj.te_xpix+x->x_width/2,
!               x->x_obj.te_ypix+x->x_height/2,
!               x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
!               x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                );
     }
--- 342,350 ----
     {
        SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
!               canvas, x,
!               text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
!               text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
!               text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
!               text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                );
     }
***************
*** 397,409 ****
  static void scratcher_reset(t_scratcher *x)
  {
     x->x_readspeed=1.;
     if ( x->x_showspeed )
     {
        SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
!               glist_getcanvas( x->x_glist ), x,
!               x->x_obj.te_xpix+x->x_width/2,
!               x->x_obj.te_ypix+x->x_height/2,
!               x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
!               x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                );
     }
--- 385,399 ----
  static void scratcher_reset(t_scratcher *x)
  {
+  t_canvas *canvas=glist_getcanvas(x->x_glist);
+ 
     x->x_readspeed=1.;
     if ( x->x_showspeed )
     {
        SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
!               canvas, x,
!               text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
!               text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
!               text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
!               text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                );
     }
***************
*** 413,417 ****
  			    int xpix, int ypix, int shift, int alt, int dbl, int doit)
  {
!   t_scratcher* x = (t_scratcher *)z;
  
      // post( "scratcher_click : x=%d y=%d doit=%d alt=%d, shift=%d", xpix, ypix, doit, alt, shift );
--- 403,408 ----
  			    int xpix, int ypix, int shift, int alt, int dbl, int doit)
  {
!  t_scratcher* x = (t_scratcher *)z;
!  t_canvas *canvas=glist_getcanvas(x->x_glist);
  
      // post( "scratcher_click : x=%d y=%d doit=%d alt=%d, shift=%d", xpix, ypix, doit, alt, shift );
***************
*** 426,434 ****
        {
          SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
!               glist_getcanvas( x->x_glist ), x,
!               x->x_obj.te_xpix+x->x_width/2,
!               x->x_obj.te_ypix+x->x_height/2,
!               x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
!               x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                );
        }
--- 417,425 ----
        {
          SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
!               canvas, x,
!               text_xpix(&x->x_obj, glist)+x->x_width/2,
!               text_ypix(&x->x_obj, glist)+x->x_height/2,
!               text_xpix(&x->x_obj, glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
!               text_ypix(&x->x_obj, glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                );
        }
***************
*** 486,501 ****
  static t_int *scratcher_perform(t_int *w)
  {
!     t_float *in = (t_float *)(w[1]);
!     t_float *out = (t_float *)(w[2]);
!     t_int n = (int)(w[3]);                      /* number of samples */
!     t_scratcher *x = (t_scratcher *)(w[4]);
! #ifdef NT
!     time_t et;
!     struct _timeb tv;
! #else
!     struct timeval tv;
!     struct timezone tz;
! #endif
!     long long perftime = 0L;
  
      x->x_readspeed += x->x_speedinc;
--- 477,488 ----
  static t_int *scratcher_perform(t_int *w)
  {
!   t_float *in = (t_float *)(w[1]);
!   t_float *out = (t_float *)(w[2]);
!   t_int n = (int)(w[3]);                      /* number of samples */
!   t_scratcher *x = (t_scratcher *)(w[4]);
!   struct timeval tv;
!   struct timezone tz;
!   long long perftime = 0L;
!   t_canvas *canvas=glist_getcanvas(x->x_glist);
  
      x->x_readspeed += x->x_speedinc;
***************
*** 515,526 ****
      {
         // get current time in ms
! #ifdef NT
!       time( &et );
!       _ftime( &tv );
!       perftime = et*1000 + tv.millitm;
! #else
!       gettimeofday( &tv, &tz );
!       perftime = tv.tv_sec*1000 + tv.tv_usec/1000;
! #endif
         if ( perftime - x->x_lastmovetime > SCRATCHER_MOVE_TIMEOUT )
         {
--- 502,507 ----
      {
         // get current time in ms
!        gettimeofday( &tv, &tz );
!        perftime = tv.tv_sec*1000 + tv.tv_usec/1000;
         if ( perftime - x->x_lastmovetime > SCRATCHER_MOVE_TIMEOUT )
         {
***************
*** 546,554 ****
            {
              SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
!                glist_getcanvas( x->x_glist ), x,
!                x->x_obj.te_xpix+x->x_width/2,
!                x->x_obj.te_ypix+x->x_height/2,
!                x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
!                x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                 );
            }
--- 527,535 ----
            {
              SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
!                canvas, x,
!                text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
!                text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
!                text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
!                text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
                 );
            }
***************
*** 592,595 ****
--- 573,578 ----
  static void scratcher_play(t_scratcher *x)
  {
+  t_canvas *canvas=glist_getcanvas(x->x_glist);
+ 
     x->x_play=1;
     // reset read position
***************
*** 598,607 ****
     if ( x->x_showspeed )
     {
!      SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", glist_getcanvas( x->x_glist ), x );
       SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
!              glist_getcanvas( x->x_glist ), x->x_obj.te_xpix+x->x_width/2,
!              x->x_obj.te_ypix+x->x_height/2,
!              x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
!              x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )), 
               x );
     }
--- 581,590 ----
     if ( x->x_showspeed )
     {
!      SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", canvas, x );
       SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
!              canvas, text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
!              text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
!              text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
!              text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )), 
               x );
     }
***************
*** 611,614 ****
--- 594,599 ----
  static void scratcher_stop(t_scratcher *x)
  {
+  t_canvas *canvas=glist_getcanvas(x->x_glist);
+ 
     x->x_play=0;
     // reset read position
***************
*** 617,626 ****
     if ( x->x_showspeed )
     {
!      SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", glist_getcanvas( x->x_glist ), x );
       SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
!              glist_getcanvas( x->x_glist ), x->x_obj.te_xpix+x->x_width/2,
!              x->x_obj.te_ypix+x->x_height/2,
!              x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
!              x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )), 
               x );
     }
--- 602,611 ----
     if ( x->x_showspeed )
     {
!      SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", canvas, x );
       SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
!              canvas, text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
!              text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
!              text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
!              text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )), 
               x );
     }
***************
*** 686,702 ****
  static void scratcher_showspeed(t_scratcher *x, t_floatarg fshowspeed )
  {
      if (fshowspeed == 0) {
        x->x_showspeed = 0;
!       SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", glist_getcanvas( x->x_glist ), x );
      }
      else
      {
        x->x_showspeed = 1;
!       SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", glist_getcanvas( x->x_glist ), x );
        SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
!                glist_getcanvas( x->x_glist ), x->x_obj.te_xpix+x->x_width/2,
!                x->x_obj.te_ypix+x->x_height/2,
!                x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
!                x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )), 
                 x );
      }
--- 671,689 ----
  static void scratcher_showspeed(t_scratcher *x, t_floatarg fshowspeed )
  {
+  t_canvas *canvas=glist_getcanvas(x->x_glist);
+ 
      if (fshowspeed == 0) {
        x->x_showspeed = 0;
!       SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", canvas, x );
      }
      else
      {
        x->x_showspeed = 1;
!       SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", canvas, x );
        SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
!                canvas, text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
!                text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
!                text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
!                text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )), 
                 x );
      }
***************
*** 792,795 ****
--- 779,783 ----
      scratcher_class = class_new(gensym("scratcher~"), (t_newmethod)scratcher_new, (t_method)scratcher_free,
                      sizeof(t_scratcher), 0, A_GIMME, 0);
+     class_sethelpsymbol( scratcher_class, gensym("scratcher~.pd") );
  
      // set callbacks
***************
*** 801,816 ****
      scratcher_widgetbehavior.w_visfn =        scratcher_vis;
      scratcher_widgetbehavior.w_clickfn =      scratcher_click;
! 	 /* 
! 	  * <hans at eds.org>: As of 0.37, pd does not have these last 
! 	  * two elements in t_widgetbehavoir anymore.
! 	  * see pd/src/notes.txt:
! 	  *           savefunction and dialog into class structure
! 	  */
! #if PD_MINOR_VERSION < 37  || !defined(PD_MINOR_VERSION)
      scratcher_widgetbehavior.w_propertiesfn = scratcher_properties;
      scratcher_widgetbehavior.w_savefn =       scratcher_save;
- #else
- 	 class_setpropertiesfn(scratcher_class, &scratcher_properties);
- 	 class_setsavefn(scratcher_class, &scratcher_save);
  #endif
  
--- 789,799 ----
      scratcher_widgetbehavior.w_visfn =        scratcher_vis;
      scratcher_widgetbehavior.w_clickfn =      scratcher_click;
! 
! #if PD_MINOR_VERSION >= 37
!     class_setpropertiesfn(scratcher_class, scratcher_properties);
!     class_setsavefn(scratcher_class, scratcher_save);
! #else
      scratcher_widgetbehavior.w_propertiesfn = scratcher_properties;
      scratcher_widgetbehavior.w_savefn =       scratcher_save;
  #endif
  

Index: Makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/unauthorized/scratcher~/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Makefile	16 Aug 2003 08:31:02 -0000	1.1
--- Makefile	2 Mar 2005 02:48:23 -0000	1.2
***************
*** 68,72 ****
  
  .c.pd_linux:
! 	../tk2c.bash <$*.tk >$*.tk2c
  	cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
  	ld -export_dynamic  -shared -o $*.pd_linux $*.o -lc -lm
--- 68,72 ----
  
  .c.pd_linux:
! 	./tk2c.bash <$*.tk >$*.tk2c
  	cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
  	ld -export_dynamic  -shared -o $*.pd_linux $*.o -lc -lm





More information about the Pd-cvs mailing list