Update of /cvsroot/pure-data/externals/unauthorized/playlist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21235
Modified Files: CHANGES.LOG help-playlist.pd playlist.c Log Message: playlist 0.11
Index: CHANGES.LOG =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/playlist/CHANGES.LOG,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CHANGES.LOG 2 Mar 2005 02:46:56 -0000 1.4 --- CHANGES.LOG 16 Nov 2005 16:57:46 -0000 1.5 *************** *** 1,2 **** --- 1,5 ---- + 0.11 + added option to hide the graphic parts ( embedded list ) + scroll by numbers 0.10 added GOP support
Index: playlist.c =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/playlist/playlist.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** playlist.c 2 Mar 2005 02:46:56 -0000 1.8 --- playlist.c 16 Nov 2005 16:57:46 -0000 1.9 *************** *** 56,60 **** static int guidebug=0;
! static char *playlist_version = "playlist: 1 click file chooser : version 0.9, written by Yves Degoyon (ydegoyon@free.fr)";
#define MAX_DIR_LENGTH 2048 // maximum length for a directory name --- 56,60 ---- static int guidebug=0;
! static char *playlist_version = "playlist: 1 click file chooser : version 0.11, written by Yves Degoyon (ydegoyon@free.fr)";
#define MAX_DIR_LENGTH 2048 // maximum length for a directory name *************** *** 115,118 **** --- 115,119 ---- t_int x_itemselected; /* index of the selected item */ t_int x_selected; /* stores selected state */ + t_int x_graphics; /* flag to draw graphics or not */ char **x_dentries; /* directory entries */ t_int x_nentries; /* number of entries in the current dir */ *************** *** 145,149 **** // 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, --- 146,152 ---- // set title SYS_VGUI3(".x%x.c delete %xTITLE\n", canvas, x); ! if ( x->x_graphics ) ! { ! 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, *************** *** 153,156 **** --- 156,160 ---- x->x_font, x ); + }
// delete previous entries *************** *** 294,306 ****
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); ! playlist_update_dir( x, glist );
--- 298,312 ----
x->x_glist = glist; ! if ( x->x_graphics ) ! { ! 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); ! } playlist_update_dir( x, glist );
*************** *** 316,332 **** 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++ ) { --- 322,341 ---- tv.tv_nsec = 10000000;
! if ( x->x_graphics ) ! { ! 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++ ) { *************** *** 346,352 **** t_int i;
! SYS_VGUI3(".x%x.c delete %xPLAYLIST\n", canvas, x); ! SYS_VGUI3(".x%x.c delete %xSCROLLLIST\n", canvas, x); ! SYS_VGUI3(".x%x.c delete %xTITLE\n", canvas, x); for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { --- 355,364 ---- t_int i;
! if ( x->x_graphics ) ! { ! SYS_VGUI3(".x%x.c delete %xPLAYLIST\n", canvas, x); ! SYS_VGUI3(".x%x.c delete %xSCROLLLIST\n", canvas, x); ! SYS_VGUI3(".x%x.c delete %xTITLE\n", canvas, x); ! } for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) { *************** *** 363,371 **** { /* sets the item in blue */ ! SYS_VGUI3(".x%x.c itemconfigure %xPLAYLIST -outline #0000FF\n", canvas, x); } else { ! SYS_VGUI3(".x%x.c itemconfigure %xPLAYLIST -outline #000000\n", canvas, x); } } --- 375,383 ---- { /* sets the item in blue */ ! if (x->x_graphics) SYS_VGUI3(".x%x.c itemconfigure %xPLAYLIST -outline #0000FF\n", canvas, x); } else { ! if (x->x_graphics) SYS_VGUI3(".x%x.c itemconfigure %xPLAYLIST -outline #000000\n", canvas, x); } } *************** *** 457,536 **** { // eventually, move down ! if ( ( x->x_cdy >= 3 ) && ! ( x->x_firstseen < x->x_nentries - ( x->x_height/x->x_charheight ) ) ) { x->x_cdy = 0; ! if ( x->x_firstseen + 1 < x->x_nentries ) { ! 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++; ! for ( i=x->x_firstseen; i< x->x_nentries; i++ ) ! { ! char *wrappedname = (char *) getbytes( x->x_width );
! if ( (i-x->x_firstseen)*x->x_charheight+5 < x->x_height ) ! { ! x->x_lastseen = i; ! 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, ! x->x_width, ! wrappedname, ! x->x_font, ! x, i ); ! } ! else break; ! } ! 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 ); } } // eventually, move up ! if ( ( x->x_cdy <= -3 ) && ! ( x->x_lastseen >= ( x->x_height/x->x_charheight ) ) ) { x->x_cdy = 0; ! if ( x->x_firstseen - 1 >= 0 ) ! { ! 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--; ! for ( i=x->x_firstseen; i< x->x_nentries; i++ ) ! { ! char *wrappedname = (char *) getbytes( x->x_width );
! if ( (i-x->x_firstseen)*x->x_charheight+5 < x->x_height ) ! { ! x->x_lastseen = i; ! 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, ! x->x_width, ! wrappedname, ! x->x_font, ! x, i ); ! } ! else break; ! } ! 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 ); } } --- 469,552 ---- { // eventually, move down ! if ( x->x_cdy >= x->x_charheight ) { x->x_cdy = 0; ! if ( x->x_firstseen < x->x_nentries - ( x->x_height/x->x_charheight ) ) { ! if ( x->x_firstseen + 1 < x->x_nentries ) ! { ! 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++; ! for ( i=x->x_firstseen; i< x->x_nentries; i++ ) ! { ! char *wrappedname = (char *) getbytes( x->x_width );
! if ( (i-x->x_firstseen)*x->x_charheight < x->x_height ) ! { ! x->x_lastseen = i; ! 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, ! x->x_width, ! wrappedname, ! x->x_font, ! x, i ); ! } ! else break; ! } ! 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 ); ! } } } // eventually, move up ! if ( x->x_cdy <= -x->x_charheight ) { x->x_cdy = 0; ! if ( x->x_lastseen >= ( x->x_height/x->x_charheight ) ) ! { ! if ( x->x_firstseen - 1 >= 0 ) ! { ! 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--; ! for ( i=x->x_firstseen; i< x->x_nentries; i++ ) ! { ! char *wrappedname = (char *) getbytes( x->x_width );
! if ( (i-x->x_firstseen)*x->x_charheight < x->x_height ) ! { ! x->x_lastseen = i; ! 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, ! x->x_width, ! wrappedname, ! x->x_font, ! x, i ); ! } ! else break; ! } ! 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 ); ! } } } *************** *** 538,541 **** --- 554,579 ---- }
+ void playlist_scroll(t_playlist *x, t_floatarg fdy) + { + t_int nbsteps, si; + + nbsteps = (t_int)abs(fdy/x->x_charheight); + // post( "playlist : iterations %d", nbsteps ); + + for (si=0; si<nbsteps; si++ ) + { + playlist_motion(x, 0, (fdy/abs(fdy))*x->x_charheight); + } + } + + void playlist_graphics(t_playlist *x, t_floatarg fgraphics) + { + if ( ( (t_int)fgraphics == 0 ) || ( (t_int)fgraphics == 1 ) ) + { + playlist_draw_erase(x, x->x_glist); + x->x_graphics = (t_int) fgraphics; + playlist_draw_new(x, x->x_glist); + } + }
int playlist_click(t_gobj *z, struct _glist *glist, *************** *** 821,826 ****
x->x_sort = 1;
! // post( "playlist : built extension=%s width=%d height=%d", x->x_extension, x->x_width, x->x_height );
return (x); --- 859,865 ----
x->x_sort = 1; + x->x_graphics = 1;
! // post( "playlist : built extension=%s width=%d height=%d", x->x_extension, x->x_width, x->x_height );
return (x); *************** *** 955,958 **** --- 994,999 ---- class_addmethod(playlist_class, (t_method)playlist_dialog, gensym("dialog"), A_GIMME, A_NULL ); class_addmethod(playlist_class, (t_method)playlist_sort, gensym("sort"), A_DEFFLOAT, A_NULL ); + class_addmethod(playlist_class, (t_method)playlist_graphics, gensym("graphics"), A_DEFFLOAT, A_NULL ); + class_addmethod(playlist_class, (t_method)playlist_scroll, gensym("scroll"), A_DEFFLOAT, A_NULL ); class_addmethod(playlist_class, (t_method)playlist_font, gensym("font"), A_SYMBOL, A_SYMBOL, A_DEFFLOAT, A_NULL );
Index: help-playlist.pd =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/playlist/help-playlist.pd,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** help-playlist.pd 18 Jul 2004 23:55:27 -0000 1.4 --- help-playlist.pd 16 Nov 2005 16:57:46 -0000 1.5 *************** *** 1,3 **** ! #N canvas 94 79 817 563 10; #X text 28 57 Constructor : playlist <extension> <width> <height>; #X text 88 95 playlist all 200 200; --- 1,3 ---- ! #N canvas 96 132 817 563 10; #X text 28 57 Constructor : playlist <extension> <width> <height>; #X text 88 95 playlist all 200 200; *************** *** 5,23 **** #X text 30 78 Examples :; #X text 72 507 Comments and bugs @ ydegoyon@free.fr; ! #X symbolatom 292 399 50 0 0 0 - - -; #X text 17 444 Note : you can scroll the list by dragging; #X text 15 455 the mouse in the yellow area; #X text 17 466 You can select and scroll in the blue area; ! #X obj 292 181 playlist all 400 200 {Helvetica 10 bold} #457782 yellow ! black red; ! #X msg 301 84 seek $1; ! #X text 406 66 You can seek a file in the list; ! #X text 405 77 It will skip the first two items ( '.' and '..'); ! #X text 405 89 and behave like a round list; #X text 28 14 Playlist lets you switch files in one click; #X text 27 25 It's handling most non-alpha characters gracefully; ! #X floatatom 355 85 5 0 0 0 - - -; ! #X symbolatom 333 426 50 0 0 0 - - -; ! #X symbolatom 379 453 50 0 0 0 - - -; #X msg 151 163 location ..; #X msg 150 140 location /tmp; --- 5,23 ---- #X text 30 78 Examples :; #X text 72 507 Comments and bugs @ ydegoyon@free.fr; ! #X symbolatom 363 437 50 0 0 0 - - -; #X text 17 444 Note : you can scroll the list by dragging; #X text 15 455 the mouse in the yellow area; #X text 17 466 You can select and scroll in the blue area; ! #X obj 360 221 playlist all 400 200 {Courier 12 bold} grey yellow black ! red; ! #X msg 373 77 seek $1; ! #X text 485 63 You can seek a file in the list; ! #X text 485 74 It will skip the first two items ( '.' and '..'); ! #X text 484 86 and behave like a round list; #X text 28 14 Playlist lets you switch files in one click; #X text 27 25 It's handling most non-alpha characters gracefully; ! #X floatatom 435 79 5 0 0 0 - - -; ! #X symbolatom 404 464 50 0 0 0 - - -; ! #X symbolatom 450 491 50 0 0 0 - - -; #X msg 151 163 location ..; #X msg 150 140 location /tmp; *************** *** 27,38 **** #X text 32 243 in a particular folder.; #X msg 151 185 location patches; ! #X msg 299 111 sort $1; ! #X obj 355 110 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; ! #X text 405 109 Use alphabetical or creation time order; #X obj 87 140 loadbang; #X text 628 136 Change the font; #X msg 300 136 font Helvetica normal 14; #X msg 478 136 font Courier bold 24; #X connect 9 0 5 0; #X connect 9 1 17 0; --- 27,47 ---- #X text 32 243 in a particular folder.; #X msg 151 185 location patches; ! #X msg 334 106 sort $1; ! #X obj 395 107 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; ! #X text 499 110 Use alphabetical or creation time order; #X obj 87 140 loadbang; #X text 628 136 Change the font; #X msg 300 136 font Helvetica normal 14; #X msg 478 136 font Courier bold 24; + #X msg 379 163 scroll 200; + #X msg 460 163 scroll -200; + #X text 551 162 Scrolling by numbers for the laziest; + #X obj 526 191 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 + 1; + #X msg 436 191 graphics $1; + #X text 655 191 Show or hide graphics; + #X msg 549 190 1; + #X obj 582 191 loadbang; #X connect 9 0 5 0; #X connect 9 1 17 0; *************** *** 48,49 **** --- 57,64 ---- #X connect 31 0 9 0; #X connect 32 0 9 0; + #X connect 33 0 9 0; + #X connect 34 0 9 0; + #X connect 36 0 37 0; + #X connect 37 0 9 0; + #X connect 39 0 36 0; + #X connect 40 0 39 0;