Update of /cvsroot/pure-data/externals/unauthorized/playlist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5422
Modified Files: CHANGES.LOG playlist.c Log Message: Added GOP supoort
Index: CHANGES.LOG =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/playlist/CHANGES.LOG,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CHANGES.LOG 18 Jul 2004 23:55:26 -0000 1.3 --- CHANGES.LOG 2 Mar 2005 02:46:56 -0000 1.4 *************** *** 1,2 **** --- 1,4 ---- + 0.10 + added GOP support 0.9 do not output directories ( for clicks and seeks )
Index: playlist.c =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/playlist/playlist.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** playlist.c 18 Jul 2004 23:55:27 -0000 1.7 --- playlist.c 2 Mar 2005 02:46:56 -0000 1.8 *************** *** 36,39 **** --- 36,41 ---- #include <ctype.h> #include <regex.h> + #include <time.h> + #include <sys/time.h> #include "m_pd.h" #include "m_imp.h" *************** *** 136,147 **** t_int i; char wrappedname[ MAX_DIR_LENGTH ];
// set title ! SYS_VGUI3(".x%x.c delete %xTITLE\n", glist_getcanvas(glist), x); ! SYS_VGUI8(".x%x.c create text %d %d -width %d -text "%s" \ ! -anchor w -font %s -tags %xTITLE\n", canvas, ! x->x_obj.te_xpix+5, ! x->x_obj.te_ypix-10, x->x_width, x->x_curdir, --- 138,152 ---- t_int i; char wrappedname[ MAX_DIR_LENGTH ]; + struct timespec tv; + + tv.tv_sec = 0; + tv.tv_nsec = 10000000;
// set title ! SYS_VGUI3(".x%x.c delete %xTITLE\n", canvas, x); ! SYS_VGUI8(".x%x.c create text %d %d -width %d -text "%s" -anchor w -font %s -tags %xTITLE\n", canvas, ! text_xpix(&x->x_obj, glist)+5, ! text_ypix(&x->x_obj, glist)-10, x->x_width, x->x_curdir, *************** *** 152,156 **** for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { ! SYS_VGUI4(".x%x.c delete %xENTRY%d\n", glist_getcanvas(glist), x, i); }
--- 157,161 ---- for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { ! SYS_VGUI4(".x%x.c delete %xENTRY%d\n", canvas, x, i); }
*************** *** 214,225 **** if ( x->x_nentries*x->x_charheight+5 < x->x_height ) { x->x_lastseen = x->x_nentries; strncpy( wrappedname, x->x_dentries[x->x_nentries], MIN(x->x_width/x->x_charwidth, MAX_DIR_LENGTH) ); wrappedname[ x->x_width/x->x_charwidth ] = '\0'; ! SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text "%s" \ ! -anchor w -font %s -tags %xENTRY%d\n", canvas, ! x->x_obj.te_xpix+5, ! x->x_obj.te_ypix+5+(x->x_nentries-x->x_firstseen)*x->x_charheight, x->x_fgcolor, x->x_secolor, --- 219,230 ---- if ( x->x_nentries*x->x_charheight+5 < x->x_height ) { + // nanosleep( &tv, NULL ); x->x_lastseen = x->x_nentries; strncpy( wrappedname, x->x_dentries[x->x_nentries], MIN(x->x_width/x->x_charwidth, MAX_DIR_LENGTH) ); wrappedname[ x->x_width/x->x_charwidth ] = '\0'; ! SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text "%s" -anchor w -font %s -tags %xENTRY%d\n", canvas, ! text_xpix(&x->x_obj, glist)+5, ! text_ypix(&x->x_obj, glist)+5+(x->x_nentries-x->x_firstseen)*x->x_charheight, x->x_fgcolor, x->x_secolor, *************** *** 288,298 **** t_canvas *canvas=glist_getcanvas(glist);
SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xPLAYLIST\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->x_bgcolor, x); SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xSCROLLLIST\n", ! canvas, x->x_obj.te_xpix+4*x->x_width/5, x->x_obj.te_ypix, ! x->x_obj.te_xpix + x->x_width, x->x_obj.te_ypix + x->x_height, x->x_sbcolor, x);
--- 293,304 ---- t_canvas *canvas=glist_getcanvas(glist);
+ x->x_glist = glist; SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xPLAYLIST\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->x_bgcolor, x); SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xSCROLLLIST\n", ! canvas, text_xpix(&x->x_obj, glist)+4*x->x_width/5, 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->x_sbcolor, x);
*************** *** 303,328 **** void playlist_draw_move(t_playlist *x, t_glist *glist) { ! t_canvas *canvas=glist_getcanvas(glist); ! t_int i;
SYS_VGUI7(".x%x.c coords %xPLAYLIST %d %d %d %d\n", canvas, x, ! 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); SYS_VGUI7(".x%x.c coords %xSCROLLLIST %d %d %d %d\n", canvas, x, ! x->x_obj.te_xpix+4*x->x_width/5, x->x_obj.te_ypix, ! x->x_obj.te_xpix+x->x_width, ! x->x_obj.te_ypix+x->x_height); SYS_VGUI5(".x%x.c coords %xTITLE %d %d\n", canvas, x, ! x->x_obj.te_xpix+5, x->x_obj.te_ypix-10 ); for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { SYS_VGUI6(".x%x.c coords %xENTRY%d %d %d\n", canvas, x, i, ! x->x_obj.te_xpix+5, ! x->x_obj.te_ypix+5+(i-x->x_firstseen)*x->x_charheight); }
--- 309,339 ---- void playlist_draw_move(t_playlist *x, t_glist *glist) { ! t_canvas *canvas=glist_getcanvas(glist); ! t_int i; ! struct timespec tv;
+ tv.tv_sec = 0; + tv.tv_nsec = 10000000; + SYS_VGUI7(".x%x.c coords %xPLAYLIST %d %d %d %d\n", canvas, x, ! 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); SYS_VGUI7(".x%x.c coords %xSCROLLLIST %d %d %d %d\n", canvas, x, ! text_xpix(&x->x_obj, glist)+4*x->x_width/5, text_ypix(&x->x_obj, glist), ! text_xpix(&x->x_obj, glist)+x->x_width, ! text_ypix(&x->x_obj, glist)+x->x_height); SYS_VGUI5(".x%x.c coords %xTITLE %d %d\n", canvas, x, ! text_xpix(&x->x_obj, glist)+5, text_ypix(&x->x_obj, glist)-10 ); for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { + // nanosleep( &tv, NULL ); SYS_VGUI6(".x%x.c coords %xENTRY%d %d %d\n", canvas, x, i, ! text_xpix(&x->x_obj, glist)+5, ! text_ypix(&x->x_obj, glist)+5+(i-x->x_firstseen)*x->x_charheight); }
*************** *** 332,337 **** void playlist_draw_erase(t_playlist* x, t_glist* glist) { ! t_canvas *canvas=glist_getcanvas(glist); ! int i;
SYS_VGUI3(".x%x.c delete %xPLAYLIST\n", canvas, x); --- 343,348 ---- void playlist_draw_erase(t_playlist* x, t_glist* glist) { ! t_canvas *canvas=glist_getcanvas(glist); ! t_int i;
SYS_VGUI3(".x%x.c delete %xPLAYLIST\n", canvas, x); *************** *** 340,344 **** for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { ! SYS_VGUI4(".x%x.c delete %xENTRY%d\n", glist_getcanvas(glist), x, i); } } --- 351,355 ---- for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { ! SYS_VGUI4(".x%x.c delete %xENTRY%d\n", canvas, x, i); } } *************** *** 346,350 **** void playlist_draw_select(t_playlist* x, t_glist* glist) { ! t_canvas *canvas=glist_getcanvas(glist);
// post( "playlist : select" ); --- 357,361 ---- void playlist_draw_select(t_playlist* x, t_glist* glist) { ! t_canvas *canvas=glist_getcanvas(glist);
// post( "playlist : select" ); *************** *** 366,384 **** int *xp1, int *yp1, int *xp2, int *yp2) { ! t_playlist* x = (t_playlist*)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; }
void playlist_save(t_gobj *z, t_binbuf *b) { ! t_playlist *x = (t_playlist *)z;
// post( "saving playlist : %s", x->x_extension ); binbuf_addv(b, "ssiissiisssss", gensym("#X"), gensym("obj"), ! (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix, gensym("playlist"), gensym(x->x_extension), x->x_width, x->x_height, gensym(x->x_font), gensym(x->x_bgcolor), gensym(x->x_sbcolor), --- 377,395 ---- int *xp1, int *yp1, int *xp2, int *yp2) { ! t_playlist* x = (t_playlist*)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; }
void playlist_save(t_gobj *z, t_binbuf *b) { ! t_playlist *x = (t_playlist *)z;
// post( "saving playlist : %s", x->x_extension ); binbuf_addv(b, "ssiissiisssss", 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("playlist"), gensym(x->x_extension), x->x_width, x->x_height, gensym(x->x_font), gensym(x->x_bgcolor), gensym(x->x_sbcolor), *************** *** 389,393 **** void playlist_select(t_gobj *z, t_glist *glist, int selected) { ! t_playlist *x = (t_playlist *)z;
x->x_selected = selected; --- 400,404 ---- void playlist_select(t_gobj *z, t_glist *glist, int selected) { ! t_playlist *x = (t_playlist *)z;
x->x_selected = selected; *************** *** 398,404 **** void playlist_vis(t_gobj *z, t_glist *glist, int vis) { ! t_playlist *x = (t_playlist *)z; ! t_rtext *y;
if (vis) { --- 409,416 ---- void playlist_vis(t_gobj *z, t_glist *glist, int vis) { ! t_playlist *x = (t_playlist *)z; ! t_rtext *y;
+ x->x_glist = glist; if (vis) { *************** *** 413,416 **** --- 425,430 ---- void playlist_delete(t_gobj *z, t_glist *glist) { + t_playlist *x = (t_playlist *)z; + canvas_deletelinesfor( glist_getcanvas(glist), (t_text *)z); } *************** *** 418,424 **** void playlist_displace(t_gobj *z, t_glist *glist, int dx, int dy) { ! t_playlist *x = (t_playlist *)z; ! int xold = x->x_obj.te_xpix; ! int yold = x->x_obj.te_ypix;
// post( "playlist_displace dx=%d dy=%d", dx, dy ); --- 432,438 ---- void playlist_displace(t_gobj *z, t_glist *glist, int dx, int dy) { ! t_playlist *x = (t_playlist *)z; ! t_int xold = text_xpix(&x->x_obj, glist); ! t_int yold = text_ypix(&x->x_obj, glist);
// post( "playlist_displace dx=%d dy=%d", dx, dy ); *************** *** 426,430 **** x->x_obj.te_xpix += dx; x->x_obj.te_ypix += dy; ! if(xold != x->x_obj.te_xpix || yold != x->x_obj.te_ypix) { playlist_draw_move(x, glist); --- 440,444 ---- x->x_obj.te_xpix += dx; x->x_obj.te_ypix += dy; ! if(xold != text_xpix(&x->x_obj, glist) || yold != text_ypix(&x->x_obj, glist)) { playlist_draw_move(x, glist); *************** *** 434,438 **** void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy) { ! int i;
x->x_cdy+=dy; --- 448,453 ---- void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy) { ! t_int i; ! t_canvas *canvas=glist_getcanvas(x->x_glist);
x->x_cdy+=dy; *************** *** 450,454 **** for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { ! SYS_VGUI4(".x%x.c delete %xENTRY%d\n", x->x_glist, x, i); } x->x_firstseen++; --- 465,469 ---- for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { ! SYS_VGUI4(".x%x.c delete %xENTRY%d\n", canvas, x, i); } x->x_firstseen++; *************** *** 462,470 **** strncpy( wrappedname, x->x_dentries[i], x->x_width/x->x_charwidth ); wrappedname[ x->x_width/x->x_charwidth ] = '\0'; ! SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text "%s" \ ! -anchor w -font %s -tags %xENTRY%d\n", ! glist_getcanvas(x->x_glist), ! x->x_obj.te_xpix+5, ! x->x_obj.te_ypix+5+(i-x->x_firstseen)*x->x_charheight, x->x_fgcolor, x->x_secolor, --- 477,484 ---- strncpy( wrappedname, x->x_dentries[i], x->x_width/x->x_charwidth ); wrappedname[ x->x_width/x->x_charwidth ] = '\0'; ! SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text "%s" -anchor w -font %s -tags %xENTRY%d\n", ! canvas, ! text_xpix(&x->x_obj, x->x_glist)+5, ! text_ypix(&x->x_obj, x->x_glist)+5+(i-x->x_firstseen)*x->x_charheight, x->x_fgcolor, x->x_secolor, *************** *** 477,481 **** } SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", ! x->x_glist, x, x->x_itemselected, x->x_secolor); // post( "playlist : moved down first=%d last=%d", x->x_firstseen, x->x_lastseen ); } --- 491,495 ---- } SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", ! canvas, x, x->x_itemselected, x->x_secolor); // post( "playlist : moved down first=%d last=%d", x->x_firstseen, x->x_lastseen ); } *************** *** 490,494 **** for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { ! SYS_VGUI4(".x%x.c delete %xENTRY%d\n", x->x_glist, x, i); } x->x_firstseen--; --- 504,508 ---- for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { ! SYS_VGUI4(".x%x.c delete %xENTRY%d\n", canvas, x, i); } x->x_firstseen--; *************** *** 504,510 **** SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text "%s" \ -anchor w -font %s -tags %xENTRY%d\n", ! glist_getcanvas(x->x_glist), ! x->x_obj.te_xpix+5, ! x->x_obj.te_ypix+5+(i-x->x_firstseen)*x->x_charheight, x->x_fgcolor, x->x_secolor, --- 518,524 ---- SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text "%s" \ -anchor w -font %s -tags %xENTRY%d\n", ! canvas, ! text_xpix(&x->x_obj, x->x_glist)+5, ! text_ypix(&x->x_obj, x->x_glist)+5+(i-x->x_firstseen)*x->x_charheight, x->x_fgcolor, x->x_secolor, *************** *** 517,521 **** } SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", ! x->x_glist, x, x->x_itemselected, x->x_secolor); // post( "playlist : moved up first=%d last=%d", x->x_firstseen, x->x_lastseen ); } --- 531,535 ---- } SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", ! canvas, x, x->x_itemselected, x->x_secolor); // post( "playlist : moved up first=%d last=%d", x->x_firstseen, x->x_lastseen ); } *************** *** 526,544 ****
int playlist_click(t_gobj *z, struct _glist *glist, ! int xpix, int ypix, int shift, int alt, int dbl, int doit) { ! t_playlist* x = (t_playlist *)z;
if (doit) { // leave a margin for scrolling without selection ! if ( (xpix-x->x_obj.te_xpix) < 4*x->x_width/5 ) { // deselect previously selected item SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", ! x->x_glist, x, x->x_itemselected, x->x_fgcolor); ! x->x_itemselected = x->x_firstseen + (ypix-x->x_obj.te_ypix)/x->x_charheight; SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", ! x->x_glist, x, x->x_itemselected, x->x_secolor); // post( "playlist : selected item : %d", x->x_itemselected ); if ( x->x_dentries && ( x->x_itemselected < x->x_nentries ) ) --- 540,559 ----
int playlist_click(t_gobj *z, struct _glist *glist, ! int xpix, int ypix, int shift, int alt, int dbl, int doit) { ! t_playlist* x = (t_playlist *)z; ! t_canvas *canvas=glist_getcanvas(x->x_glist);
if (doit) { // leave a margin for scrolling without selection ! if ( (xpix-text_xpix(&x->x_obj, glist)) < 4*x->x_width/5 ) { // deselect previously selected item SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", ! canvas, x, x->x_itemselected, x->x_fgcolor); ! x->x_itemselected = x->x_firstseen + (ypix-text_ypix(&x->x_obj, glist))/x->x_charheight; SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", ! canvas, x, x->x_itemselected, x->x_secolor); // post( "playlist : selected item : %d", x->x_itemselected ); if ( x->x_dentries && ( x->x_itemselected < x->x_nentries ) ) *************** *** 591,596 **** } } ! glist_grab(glist, &x->x_obj.te_g, (t_glistmotionfn)playlist_motion, ! 0, xpix, ypix); } return (1); --- 606,612 ---- } } ! x->x_glist = glist; ! glist_grab( glist, &x->x_obj.te_g, (t_glistmotionfn)playlist_motion, ! NULL, xpix, ypix ); } return (1); *************** *** 599,604 **** static void playlist_properties(t_gobj *z, t_glist *owner) { ! char buf[800]; ! t_playlist *x=(t_playlist *)z;
sprintf(buf, "pdtk_playlist_dialog %%s %s %d %d %s %s %s %s %s\n", --- 615,620 ---- static void playlist_properties(t_gobj *z, t_glist *owner) { ! char buf[800]; ! t_playlist *x=(t_playlist *)z;
sprintf(buf, "pdtk_playlist_dialog %%s %s %d %d %s %s %s %s %s\n", *************** *** 646,652 **** t_playlist *playlist_new(t_symbol *s, int argc, t_atom *argv ) { ! t_int i, argoffset=0; ! t_playlist *x; ! char *tmpcurdir;
x = (t_playlist *)pd_new(playlist_class); --- 662,668 ---- t_playlist *playlist_new(t_symbol *s, int argc, t_atom *argv ) { ! t_int i, argoffset=0; ! t_playlist *x; ! char *tmpcurdir;
x = (t_playlist *)pd_new(playlist_class); *************** *** 846,850 **** void playlist_seek(t_playlist *x, t_floatarg fseeked) { ! int iout=0;
if ( fseeked < 0 ) --- 862,867 ---- void playlist_seek(t_playlist *x, t_floatarg fseeked) { ! t_int iout=0; ! t_canvas *canvas=glist_getcanvas(x->x_glist);
if ( fseeked < 0 ) *************** *** 863,869 **** return; } ! SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", x->x_glist, x, x->x_itemselected, x->x_fgcolor); x->x_itemselected = iout; ! SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", x->x_glist, x, x->x_itemselected, x->x_secolor); playlist_output_current(x); } --- 880,886 ---- return; } ! SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", canvas, x, x->x_itemselected, x->x_fgcolor); x->x_itemselected = iout; ! SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", canvas, x, x->x_itemselected, x->x_secolor); playlist_output_current(x); }