From d145fa6f792d6c44da2feec90507adb94e40323e Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sun, 31 Jul 2011 03:59:16 +0000 Subject: got everything building using the template Makefile svn path=/trunk/externals/unauthorized/; revision=15173 --- playlist/INSTALL | 15 - playlist/playlist-help.pd | 64 --- playlist/playlist.c | 1072 --------------------------------------------- playlist/playlist.tk | 154 ------- playlist/playlist.tk2c | 123 ------ playlist/tk2c.bash | 24 - playlist/xmms.pd | 144 ------ 7 files changed, 1596 deletions(-) delete mode 100644 playlist/INSTALL delete mode 100644 playlist/playlist-help.pd delete mode 100644 playlist/playlist.c delete mode 100644 playlist/playlist.tk delete mode 100644 playlist/playlist.tk2c delete mode 100755 playlist/tk2c.bash delete mode 100644 playlist/xmms.pd (limited to 'playlist') diff --git a/playlist/INSTALL b/playlist/INSTALL deleted file mode 100644 index 972bba0..0000000 --- a/playlist/INSTALL +++ /dev/null @@ -1,15 +0,0 @@ -untar in /my/pd/dir/externs - -cd /my/pd/dir/externs/playlist - -make clean - -make - -make install - -open help-playlist.pd - -Thanx for getting here. -Yves/ -comments and bugs @ ydegoyon@free.fr diff --git a/playlist/playlist-help.pd b/playlist/playlist-help.pd deleted file mode 100644 index b035bc3..0000000 --- a/playlist/playlist-help.pd +++ /dev/null @@ -1,64 +0,0 @@ -#N canvas 96 132 817 563 10; -#X text 28 57 Constructor : playlist ; -#X text 88 95 playlist all 200 200; -#X text 88 107 playlist mp3 200 200; -#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; -#X text 33 212 You can change change location; -#X text 33 222 with a message.; -#X text 33 234 Thus \, you can initialize the object; -#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; -#X connect 9 2 18 0; -#X connect 10 0 9 0; -#X connect 16 0 10 0; -#X connect 19 0 9 0; -#X connect 20 0 9 0; -#X connect 25 0 9 0; -#X connect 26 0 9 0; -#X connect 27 0 26 0; -#X connect 29 0 20 0; -#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; diff --git a/playlist/playlist.c b/playlist/playlist.c deleted file mode 100644 index 4576267..0000000 --- a/playlist/playlist.c +++ /dev/null @@ -1,1072 +0,0 @@ -/*------------------------ playlist~ ------------------------------------------ */ -/* */ -/* playlist~ : lets you choose a file with 1 click */ -/* or by sending a 'seek #' message */ -/* constructor : playlist */ -/* */ -/* Copyleft Yves Degoyon ( ydegoyon@free.fr ) */ -/* */ -/* This program is free software; you can redistribute it and/or */ -/* modify it under the terms of the GNU General Public License */ -/* as published by the Free Software Foundation; either version 2 */ -/* of the License, or (at your option) any later version. */ -/* */ -/* See file LICENSE for further informations on licensing terms. */ -/* */ -/* This program is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program; if not, write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* */ -/* Based on PureData by Miller Puckette and others. */ -/* */ -/* "If a man's made of blood and iron" */ -/* "Doctor, doctor, what's in my chest ????" */ -/* Gang Of Four -- Guns Before Butter */ -/* ---------------------------------------------------------------------------- */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "m_pd.h" -#include "m_imp.h" -#include "g_canvas.h" -#include - -#ifdef _WIN32 -#include -#include -#include - -int scandir(const char *dir, struct dirent ***namelist, - int (*select)(const struct dirent *), - int (*compar)(const struct dirent **, const struct dirent **)) { - DIR *d; - struct dirent *entry; - register int i=0; - size_t entrysize; - - if ((d=opendir(dir)) == NULL) - return(-1); - - *namelist=NULL; - while ((entry=readdir(d)) != NULL) - { - if (select == NULL || (select != NULL && (*select)(entry))) - { - *namelist=(struct dirent **)realloc((void *)(*namelist), - (size_t)((i+1)*sizeof(struct dirent *))); - if (*namelist == NULL) return(-1); - entrysize=sizeof(struct dirent)-sizeof(entry->d_name)+strlen(entry->d_name)+1; - (*namelist)[i]=(struct dirent *)malloc(entrysize); - if ((*namelist)[i] == NULL) return(-1); - memcpy((*namelist)[i], entry, entrysize); - i++; - } - } - if (closedir(d)) return(-1); - if (i == 0) return(-1); - if (compar != NULL) - qsort((void *)(*namelist), (size_t)i, sizeof(struct dirent *), compar); - - return(i); -} - -int alphasort(const struct dirent **a, const struct dirent **b) { - return(strcmp((*a)->d_name, (*b)->d_name)); - } - -int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **)); -int alphasort(const struct dirent **, const struct dirent **); - -#else -#include -#endif - -t_widgetbehavior playlist_widgetbehavior; -static t_class *playlist_class; - -static int guidebug=0; - -static char *playlist_version = "playlist: 1 click file chooser : version 0.12, written by Yves Degoyon (ydegoyon@free.fr)"; - -#define MAX_DIR_LENGTH 2048 // maximum length for a directory name - -#define MIN(a,b) (a>b?b:a) - -#define SYS_VGUI2(a,b) if (guidebug) \ - post(a,b);\ - sys_vgui(a,b) - -#define SYS_VGUI3(a,b,c) if (guidebug) \ - post(a,b,c);\ - sys_vgui(a,b,c) - -#define SYS_VGUI4(a,b,c,d) if (guidebug) \ - post(a,b,c,d);\ - sys_vgui(a,b,c,d) - -#define SYS_VGUI5(a,b,c,d,e) if (guidebug) \ - post(a,b,c,d,e);\ - sys_vgui(a,b,c,d,e) - -#define SYS_VGUI6(a,b,c,d,e,f) if (guidebug) \ - post(a,b,c,d,e,f);\ - sys_vgui(a,b,c,d,e,f) - -#define SYS_VGUI7(a,b,c,d,e,f,g) if (guidebug) \ - post(a,b,c,d,e,f,g);\ - sys_vgui(a,b,c,d,e,f,g) - -#define SYS_VGUI8(a,b,c,d,e,f,g,h) if (guidebug) \ - post(a,b,c,d,e,f,g,h);\ - sys_vgui(a,b,c,d,e,f,g,h) - -#define SYS_VGUI9(a,b,c,d,e,f,g,h,i) if (guidebug) \ - post(a,b,c,d,e,f,g,h,i );\ - sys_vgui(a,b,c,d,e,f,g,h,i) - -#define SYS_VGUI10(a,b,c,d,e,f,g,h,i,j) if (guidebug) \ - post(a,b,c,d,e,f,g,h,i,j );\ - sys_vgui(a,b,c,d,e,f,g,h,i,j) - -#define SYS_VGUI11(a,b,c,d,e,f,g,h,i,j,k) if (guidebug) \ - post(a,b,c,d,e,f,g,h,i,j,k );\ - sys_vgui(a,b,c,d,e,f,g,h,i,j,k) - - -typedef struct _playlist -{ - t_object x_obj; - t_glist *x_glist; - t_outlet *x_fullpath; - t_outlet *x_file; - t_outlet *x_dir; - char *x_extension; /* extension to selected files */ - t_int x_height; /* height of the playlist */ - t_int x_width; /* width of the playlist */ - 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 */ - t_int x_pnentries; /* previous size of entries list */ - t_int x_firstseen; /* first displayed entry */ - t_int x_lastseen; /* last displayed entry */ - t_int x_cdy; /* cumulated y drag */ - t_int x_sort; /* sorting option flag */ - char *x_curdir; /* current directory informations */ - char *x_font; /* font used for entries */ - t_int x_charheight; /* height of characters */ - t_int x_charwidth; /* width of characters */ - char *x_bgcolor; /* background color */ - char *x_sbcolor; /* scrollbar color */ - char *x_fgcolor; /* foreground color */ - char *x_secolor; /* selection color */ -} t_playlist; - - -static void playlist_update_dir(t_playlist *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - 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); - 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, - text_ypix(&x->x_obj, glist)-10, - x->x_width, - x->x_curdir, - x->x_font, - x ); - } - - // delete previous entries - for ( i=x->x_firstseen; i<=x->x_lastseen; i++ ) - { - SYS_VGUI4(".x%x.c delete %xENTRY%d\n", canvas, x, i); - } - - // display the content of current directory - { - t_int nentries, i; - struct dirent** dentries; /* all directory entries */ - - // post( "playlist : scandir : %s", x->x_curdir ); - if ( ( nentries = scandir(x->x_curdir, &dentries, NULL, (x->x_sort==1)?alphasort:NULL ) ) == -1 ) - { - post( "playlist : could not scan current directory ( where the hell are you ??? )" ); - perror( "scandir" ); - return; - } - - x->x_firstseen = 0; - if ( x->x_dentries ) - { - for ( i=0; ix_nentries; i++ ) - { - // post( "playlist : freeing entry %d size=%d : %s", i, strlen( x->x_dentries[i] ) + 1, x->x_dentries[i] ); - freebytes( x->x_dentries[i], strlen( x->x_dentries[i] ) + 1 ); - } - } - if ( x->x_pnentries != -1 ) - { - freebytes( x->x_dentries, x->x_pnentries*sizeof(char**) ); - } - - x->x_nentries = 0; - // post( "playlist : allocating dentries %d", nentries ); - x->x_dentries = (char **) getbytes( nentries*sizeof(char**) ) ; - x->x_pnentries = nentries; - for ( i=0; id_name ) ) != NULL ) ) || - ( strstr( dentries[i]->d_name, x->x_extension ) ) || - ( !strcmp( x->x_extension, "all" ) ) - ) - { - // close temporarily opened dir - if ( tmpdir ) - { - if ( closedir( tmpdir ) < 0 ) - { - post( "playlist : could not close directory %s", dentries[i]->d_name ); - } - } - - // post( "playlist : allocating entry %d %d : %s", x->x_nentries, strlen( dentries[i]->d_name ) + 1, dentries[i]->d_name ); - x->x_dentries[x->x_nentries] = ( char * ) getbytes( strlen( dentries[i]->d_name ) + 1 ); - strcpy( x->x_dentries[x->x_nentries], dentries[i]->d_name ); - - // display the entry if displayable - 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, - x->x_width, - wrappedname, - x->x_font, - x, x->x_nentries ); - } - x->x_nentries++; - } - - } - - } -} - -static void playlist_output_current(t_playlist* x) -{ - // output the selected dir+file - // check that it's not a directory - if ( chdir( x->x_dentries[x->x_itemselected] ) == 0 ) - { - chdir( x->x_curdir ); - return; - } - - if ( x->x_dentries && x->x_itemselected < x->x_nentries && x->x_itemselected >= 0 ) - { - char* tmpstring = (char*) getbytes( strlen( x->x_curdir ) + strlen( x->x_dentries[x->x_itemselected]) + 2 ); - - sprintf( tmpstring, "%s/%s", x->x_curdir, x->x_dentries[x->x_itemselected] ); - outlet_symbol( x->x_dir, gensym( x->x_curdir ) ); - outlet_symbol( x->x_file, gensym( x->x_dentries[x->x_itemselected] ) ); - outlet_symbol( x->x_fullpath, gensym( tmpstring ) ); - freebytes( tmpstring, strlen( x->x_curdir ) + strlen( x->x_dentries[x->x_itemselected]) + 2 ); - } -} - -static void playlist_sort(t_playlist* x, t_floatarg fsort) -{ - if ( ( (t_int)fsort != 0 ) && ( (t_int)fsort != 1 ) ) - { - post( "playlist : wrong argument to playlist message : %d", (t_int)fsort ); - return; - } - - x->x_sort = (t_int) fsort; - playlist_update_dir( x, x->x_glist ); -} - -static void playlist_font(t_playlist* x, t_symbol *fname, t_symbol *fcase, t_floatarg fsize) -{ - if ( (t_int)fsize <= 4 ) - { - post( "playlist : wrong font size in font message : %d", (t_int)fsize ); - return; - } - sprintf( x->x_font, "{%s %d %s}", fname->s_name, (int)fsize, fcase->s_name ); - x->x_charheight = (t_int)fsize; - x->x_charwidth = (2*x->x_charheight)/3; - post( "playlist : setting font to : %s", x->x_font ); - playlist_update_dir( x, x->x_glist ); -} - -static void playlist_draw_new(t_playlist *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - 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 ); - -} - -static 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; - - 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++ ) - { - // 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); - } - - canvas_fixlinesfor( canvas, (t_text*)x ); -} - -static void playlist_draw_erase(t_playlist* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - 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++ ) - { - SYS_VGUI4(".x%x.c delete %xENTRY%d\n", canvas, x, i); - } -} - -static void playlist_draw_select(t_playlist* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - // post( "playlist : select" ); - if(x->x_selected) - { - /* 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); - } -} - -/* ------------------------ playlist widgetbehaviour----------------------------- */ - - -static void playlist_getrect(t_gobj *z, t_glist *owner, - 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; -} - -static 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), - gensym(x->x_fgcolor), gensym(x->x_secolor) ); - binbuf_addv(b, ";"); -} - -static void playlist_select(t_gobj *z, t_glist *glist, int selected) -{ - t_playlist *x = (t_playlist *)z; - - x->x_selected = selected; - - playlist_draw_select( x, glist ); -} - -static void playlist_vis(t_gobj *z, t_glist *glist, int vis) -{ - t_playlist *x = (t_playlist *)z; - - x->x_glist = glist; - if (vis) - { - playlist_draw_new( x, glist ); - } - else - { - playlist_draw_erase( x, glist ); - } -} - -static void playlist_delete(t_gobj *z, t_glist *glist) -{ - canvas_deletelinesfor(glist, (t_text *)z); -} - -static 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 ); - - 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); - } -} - -static 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; - - // check if we need to scroll - if ( ( x->x_lastseen < x->x_nentries ) ) - { - // 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 ); - } - } - } - } // scroll test -} - -static 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; six_charheight); - } -} - -static 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); - } -} - -static 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 ) ) - { - char *tmpstring = (char *) getbytes( strlen( x->x_curdir ) + strlen( x->x_dentries[x->x_itemselected] ) + 2 ); - sprintf( tmpstring, "%s/%s", x->x_curdir, x->x_dentries[x->x_itemselected] ); - // post( "playlist : chdir : %s", tmpstring ); - if ( chdir( tmpstring ) < 0 ) - { - playlist_output_current(x); - } - else - { - if ( !strcmp( x->x_dentries[ x->x_itemselected ], ".." ) ) - { - char *iamthelastslash; - - iamthelastslash = strrchr( x->x_curdir, '/' ); - *iamthelastslash = '\0'; - - if ( !strcmp( x->x_curdir, "" ) ) - { - strcpy( x->x_curdir, "/" ); - } - } - else - if ( !strcmp( x->x_dentries[ x->x_itemselected ], "." ) ) - { - // nothing - } - else - { - if ( strlen( x->x_curdir ) + strlen( x->x_dentries[x->x_itemselected] ) + 2 > MAX_DIR_LENGTH ) - { - post( "playlist : maximum dir length reached : cannot change directory" ); - return -1; - } - if ( strcmp( x->x_curdir, "/" ) ) - { - sprintf( x->x_curdir, "%s/%s", x->x_curdir, x->x_dentries[x->x_itemselected] ); - } - else - { - sprintf( x->x_curdir, "/%s", x->x_dentries[x->x_itemselected] ); - } - } - - playlist_update_dir( x, glist ); - } - } - } - x->x_glist = glist; - glist_grab( glist, &x->x_obj.te_g, (t_glistmotionfn)playlist_motion, - NULL, xpix, ypix ); - } - return (1); -} - -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", - x->x_extension, (int)x->x_width, (int)x->x_height, - x->x_font, x->x_bgcolor, x->x_sbcolor, - x->x_fgcolor, x->x_secolor ); - // post("playlist_properties : %s", buf ); - gfxstub_new(&x->x_obj.ob_pd, x, buf); -} - -static void playlist_dialog(t_playlist *x, t_symbol *s, int argc, t_atom *argv) -{ - if ( !x ) { - post( "playlist : error :tried to set properties on an unexisting object" ); - } - if ( argc != 10 ) - { - post( "playlist : error in the number of arguments ( %d instead of 10 )", argc ); - return; - } - if ( argv[0].a_type != A_SYMBOL || argv[1].a_type != A_FLOAT || - argv[2].a_type != A_FLOAT || argv[3].a_type != A_SYMBOL || - argv[4].a_type != A_FLOAT || argv[5].a_type != A_SYMBOL || - argv[6].a_type != A_SYMBOL || argv[7].a_type != A_SYMBOL || - argv[8].a_type != A_SYMBOL || argv[9].a_type != A_SYMBOL ) { - post( "playlist : wrong arguments" ); - return; - } - x->x_extension = argv[0].a_w.w_symbol->s_name; - x->x_width = (int)argv[1].a_w.w_float; - x->x_height = (int)argv[2].a_w.w_float; - sprintf( x->x_font, "{%s %d %s}", argv[3].a_w.w_symbol->s_name, - (int)argv[4].a_w.w_float, argv[5].a_w.w_symbol->s_name ); - x->x_charheight = (t_int)argv[4].a_w.w_float; - strcpy( x->x_bgcolor, argv[6].a_w.w_symbol->s_name ); - strcpy( x->x_sbcolor, argv[7].a_w.w_symbol->s_name ); - strcpy( x->x_fgcolor, argv[8].a_w.w_symbol->s_name ); - strcpy( x->x_secolor, argv[9].a_w.w_symbol->s_name ); - - playlist_draw_erase(x, x->x_glist); - playlist_draw_new(x, x->x_glist); -} - - -static 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); - - x->x_extension = ( char * ) getbytes( MAX_DIR_LENGTH ); - sprintf( x->x_extension, "all" ); - x->x_width = 400; - x->x_height = 300; - x->x_font = ( char * ) getbytes( MAX_DIR_LENGTH ); - sprintf( x->x_font, "{Helvetica 10 bold}" ); - x->x_charheight = 10; - x->x_charwidth = (2*10)/3; - x->x_bgcolor = ( char * ) getbytes( MAX_DIR_LENGTH ); - sprintf( x->x_bgcolor, "#457782" ); - x->x_sbcolor = ( char * ) getbytes( MAX_DIR_LENGTH ); - sprintf( x->x_sbcolor, "yellow" ); - x->x_fgcolor = ( char * ) getbytes( MAX_DIR_LENGTH ); - sprintf( x->x_fgcolor, "black" ); - x->x_secolor = ( char * ) getbytes( MAX_DIR_LENGTH ); - sprintf( x->x_secolor, "red" ); - - if ( argc >= 1 ) - { - if ( argv[0].a_type != A_SYMBOL ) - { - error( "playlist : wrong argument (extension : 1)" ); - return NULL; - } - if ( !strcmp( argv[0].a_w.w_symbol->s_name, "" ) ) - { - error( "playlist : no extension specified" ); - error( "playlist : usage : playlist " ); - return NULL; - } - strcpy( x->x_extension, argv[0].a_w.w_symbol->s_name ); - } - if ( argc >= 2 ) - { - if ( argv[1].a_type != A_FLOAT ) - { - error( "playlist : wrong argument (width : 2)" ); - return NULL; - } - if ( (int)argv[1].a_w.w_float <= 0 ) - { - error( "playlist : wrong width (%d)", (t_int)(int)argv[1].a_w.w_float ); - error( "playlist : usage : playlist " ); - return NULL; - } - x->x_width = (int)argv[1].a_w.w_float; - } - if ( argc >= 3 ) - { - if ( argv[2].a_type != A_FLOAT ) - { - error( "playlist : wrong argument (height : 3)" ); - return NULL; - } - if ( (int)argv[2].a_w.w_float <= 0 ) - { - error( "playlist : wrong height (%d)", (t_int)(int)argv[2].a_w.w_float ); - error( "playlist : usage : playlist " ); - return NULL; - } - x->x_height = (int)argv[2].a_w.w_float; - } - if ( argc >= 6 ) - { - if ( argv[3].a_type != A_SYMBOL || - argv[5].a_type != A_SYMBOL ) - { - error( "playlist : wrong arguments (font : 4,6)" ); - error( "argument types : %d %d", argv[3].a_type, argv[5].a_type ); - return NULL; - } - if ( argv[4].a_type != A_SYMBOL && - argv[4].a_type != A_FLOAT ) - { - error( "playlist : wrong arguments (font size : 5)" ); - error( "argument types : %d", argv[4].a_type ); - return NULL; - } - if ( argv[4].a_type == A_SYMBOL ) - { - sprintf( x->x_font, "%s", argv[3].a_w.w_symbol->s_name ); - x->x_charheight = (t_int)atoi( strstr( argv[3].a_w.w_symbol->s_name, " ") ); - argoffset=2; - } - if ( argv[4].a_type == A_FLOAT ) - { - x->x_charheight = (t_int)argv[4].a_w.w_float; - sprintf( x->x_font, "%s %d %s", argv[3].a_w.w_symbol->s_name, - (int)x->x_charheight, argv[5].a_w.w_symbol->s_name ); - argoffset=0; - } - post( "playlist : font : %s, size : %d", x->x_font, x->x_charheight ); - } - if ( argc >= 7-argoffset ) - { - if ( argv[6-argoffset].a_type != A_SYMBOL ) - { - error( "playlist : wrong arguments (background color : %d)", 7-argoffset ); - return NULL; - } - strcpy( x->x_bgcolor, argv[6-argoffset].a_w.w_symbol->s_name ); - } - if ( argc >= 8-argoffset ) - { - if ( argv[7-argoffset].a_type != A_SYMBOL ) - { - error( "playlist : wrong arguments (scrollbar color : %d)", 8-argoffset ); - return NULL; - } - strcpy( x->x_sbcolor, argv[7-argoffset].a_w.w_symbol->s_name ); - } - if ( argc >= 9-argoffset ) - { - if ( argv[8-argoffset].a_type != A_SYMBOL ) - { - error( "playlist : wrong arguments (foreground color : %d)", 9-argoffset ); - return NULL; - } - strcpy( x->x_fgcolor, argv[8-argoffset].a_w.w_symbol->s_name ); - } - if ( argc >= 10-argoffset ) - { - if ( argv[9-argoffset].a_type != A_SYMBOL ) - { - error( "playlist : wrong arguments (selection color : %d)", 10-argoffset ); - return NULL; - } - strcpy( x->x_secolor, argv[9-argoffset].a_w.w_symbol->s_name ); - } - - x->x_fullpath = outlet_new(&x->x_obj, &s_symbol ); - x->x_file = outlet_new(&x->x_obj, &s_symbol ); - x->x_dir = outlet_new(&x->x_obj, &s_symbol ); - - x->x_glist = (t_glist *) canvas_getcurrent(); - x->x_nentries = 0; - x->x_pnentries = 0; - x->x_dentries = NULL; - - // get current directory full path - x->x_curdir = ( char * ) getbytes( MAX_DIR_LENGTH ); - -#ifdef _WIN32 - char path[_MAX_DIR]; - - _getcwd (path, _MAX_DIR); - post ("Current directory is: %s", path); - tmpcurdir = path; - -#else - tmpcurdir = getenv( "PWD" ); -#endif - - if ( tmpcurdir == NULL ) - { - post( "playlist : could not get current directory ( where the hell are you ??? )" ); - return NULL; - } - strncpy( x->x_curdir, tmpcurdir, strlen( tmpcurdir ) ); - x->x_curdir[ strlen( tmpcurdir ) ] = '\0'; - - x->x_selected = 0; - x->x_itemselected = -1; - - 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); -} - -static void playlist_free(t_playlist *x) -{ - // post( "playlist : playlist_free" ); - if ( x->x_extension ) - { - freebytes( x->x_extension, MAX_DIR_LENGTH ); - } - if ( x->x_curdir ) - { - freebytes( x->x_curdir, MAX_DIR_LENGTH ); - } - if ( x->x_font ) - { - freebytes( x->x_font, MAX_DIR_LENGTH ); - } - if ( x->x_bgcolor ) - { - freebytes( x->x_bgcolor, MAX_DIR_LENGTH ); - } - if ( x->x_sbcolor ) - { - freebytes( x->x_sbcolor, MAX_DIR_LENGTH ); - } - if ( x->x_fgcolor ) - { - freebytes( x->x_fgcolor, MAX_DIR_LENGTH ); - } - if ( x->x_secolor ) - { - freebytes( x->x_secolor, MAX_DIR_LENGTH ); - } -} - -static void playlist_seek(t_playlist *x, t_floatarg fseeked) -{ - t_int iout=0; - t_canvas *canvas=glist_getcanvas(x->x_glist); - - if ( fseeked < 0 ) - { - post( "playlist : wrong searched file : %f", fseeked ); - return; - } - - if ( x->x_nentries > 2 ) - { - // do not select . or .. - iout = (int)fseeked % (x->x_nentries-2) + 2; - } - else - { - 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); -} - -static void playlist_location(t_playlist *x, t_symbol *flocation) -{ - int iout=0; - char olddir[ MAX_DIR_LENGTH ]; /* remember old location */ - - strcpy( olddir, x->x_curdir ); - - if ( !strcmp( flocation->s_name, ".." ) ) - { - char *iamthelastslash; - - iamthelastslash = strrchr( x->x_curdir, '/' ); - *iamthelastslash = '\0'; - - if ( !strcmp( x->x_curdir, "" ) ) - { - strcpy( x->x_curdir, "/" ); - } - } - else - if ( !strncmp( flocation->s_name, "/", 1 ) ) - { - // absolute path required - if ( strlen( flocation->s_name ) >= MAX_DIR_LENGTH ) - { - error( "playlist : maximum dir length reached : cannot change directory" ); - return; - } - strncpy( x->x_curdir, flocation->s_name, MAX_DIR_LENGTH ); - } - else - { - // relative path - if ( strlen( x->x_curdir ) + strlen( flocation->s_name ) + 2 > MAX_DIR_LENGTH ) - { - post( "playlist : maximum dir length reached : cannot change directory" ); - return; - } - if ( strcmp( x->x_curdir, "/" ) ) - { - sprintf( x->x_curdir, "%s/%s", x->x_curdir, flocation->s_name ); - } - else - { - sprintf( x->x_curdir, "/%s", flocation->s_name ); - } - } - - if ( chdir( x->x_curdir ) < 0 ) - { - error( "playlist : requested location >%s< is not a directory", x->x_curdir ); - strcpy( x->x_curdir, olddir ); - return; - } - - playlist_update_dir( x, x->x_glist ); -} - -void playlist_setup(void) -{ - post( playlist_version ); -#include "playlist.tk2c" - playlist_class = class_new(gensym("playlist"), (t_newmethod)playlist_new, - (t_method)playlist_free, sizeof(t_playlist), - CLASS_DEFAULT, A_GIMME, 0); - class_addmethod(playlist_class, (t_method)playlist_seek, gensym("seek"), A_DEFFLOAT, A_NULL ); - class_addmethod(playlist_class, (t_method)playlist_location, gensym("location"), A_SYMBOL, A_NULL ); - 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 ); - - playlist_widgetbehavior.w_getrectfn = playlist_getrect; - playlist_widgetbehavior.w_displacefn = playlist_displace; - playlist_widgetbehavior.w_selectfn = playlist_select; - playlist_widgetbehavior.w_activatefn = NULL; - playlist_widgetbehavior.w_deletefn = playlist_delete; - playlist_widgetbehavior.w_visfn = playlist_vis; - playlist_widgetbehavior.w_clickfn = playlist_click; - -#if PD_MINOR_VERSION >= 37 - class_setpropertiesfn(playlist_class, playlist_properties); - class_setsavefn(playlist_class, playlist_save); -#else - playlist_widgetbehavior.w_propertiesfn = playlist_properties; - playlist_widgetbehavior.w_savefn = playlist_save; -#endif - - class_setwidget(playlist_class, &playlist_widgetbehavior); - -} diff --git a/playlist/playlist.tk b/playlist/playlist.tk deleted file mode 100644 index 5a22a05..0000000 --- a/playlist/playlist.tk +++ /dev/null @@ -1,154 +0,0 @@ -############ playlist procedures -- ydegoyon@free.fr ######### - -proc playlist_apply {id} { -# strip "." from the TK id to make a variable name suffix - set vid [string trimleft $id .] -# for each variable, make a local variable to hold its name... - set var_graph_extension [concat graph_extension_$vid] - global $var_graph_extension - set var_graph_width [concat graph_width_$vid] - global $var_graph_width - set var_graph_height [concat graph_height$vid] - global $var_graph_height - set var_graph_font [concat graph_font$vid] - global $var_graph_font - set var_graph_bgcolor [concat graph_bgcolor$vid] - global $var_graph_bgcolor - set var_graph_sbcolor [concat graph_sbcolor$vid] - global $var_graph_sbcolor - set var_graph_fgcolor [concat graph_fgcolor$vid] - global $var_graph_fgcolor - set var_graph_secolor [concat graph_secolor$vid] - global $var_graph_secolor - - set cmd [concat $id dialog \ - [eval concat $$var_graph_extension] \ - [eval concat $$var_graph_width] \ - [eval concat $$var_graph_height] \ - [eval concat $$var_graph_font] \ - [eval concat $$var_graph_bgcolor] \ - [eval concat $$var_graph_sbcolor] \ - [eval concat $$var_graph_fgcolor] \ - [eval concat $$var_graph_secolor] \ - \;] - #puts stderr $cmd - pd $cmd -} - -proc playlist_cancel {id} { - set cmd [concat $id cancel \;] - #puts stderr $cmd - pd $cmd -} - -proc playlist_ok {id} { - playlist_apply $id - playlist_cancel $id -} - -proc pdtk_playlist_dialog {id extension width height font bgcolor sbcolor fgcolor secolor} { - set vid [string trimleft $id .] - set var_graph_extension [concat graph_extension_$vid] - global $var_graph_extension - set var_graph_width [concat graph_width_$vid] - global $var_graph_width - set var_graph_height [concat graph_height$vid] - global $var_graph_height - set var_graph_font [concat graph_font$vid] - global $var_graph_font - set var_graph_bgcolor [concat graph_bgcolor$vid] - global $var_graph_bgcolor - set var_graph_sbcolor [concat graph_sbcolor$vid] - global $var_graph_sbcolor - set var_graph_fgcolor [concat graph_fgcolor$vid] - global $var_graph_fgcolor - set var_graph_secolor [concat graph_secolor$vid] - global $var_graph_secolor - - set $var_graph_extension $extension - set $var_graph_width $width - set $var_graph_height $height - set $var_graph_font $font - set $var_graph_bgcolor $bgcolor - set $var_graph_sbcolor $sbcolor - set $var_graph_fgcolor $fgcolor - set $var_graph_secolor $secolor - - toplevel $id - wm title $id {playlist} - wm protocol $id WM_DELETE_WINDOW [concat playlist_cancel $id] - - label $id.label -text {PLAYLIST PROPERTIES} - pack $id.label -side top - - frame $id.buttonframe - pack $id.buttonframe -side bottom -fill x -pady 2m - button $id.buttonframe.cancel -text {Cancel}\ - -command "playlist_cancel $id" - button $id.buttonframe.apply -text {Apply}\ - -command "playlist_apply $id" - button $id.buttonframe.ok -text {OK}\ - -command "playlist_ok $id" - pack $id.buttonframe.cancel -side left -expand 1 - pack $id.buttonframe.apply -side left -expand 1 - pack $id.buttonframe.ok -side left -expand 1 - - frame $id.1rangef - pack $id.1rangef -side top - label $id.1rangef.lextension -text "Files Extension :" - entry $id.1rangef.extension -textvariable $var_graph_extension -width 7 - pack $id.1rangef.lextension $id.1rangef.extension -side left - - frame $id.2rangef - pack $id.2rangef -side top - label $id.2rangef.lwidth -text "Width :" - entry $id.2rangef.width -textvariable $var_graph_width -width 7 - pack $id.2rangef.lwidth $id.2rangef.width -side left - - frame $id.3rangef - pack $id.3rangef -side top - label $id.3rangef.lheight -text "Height :" - entry $id.3rangef.height -textvariable $var_graph_height -width 7 - pack $id.3rangef.lheight $id.3rangef.height -side left - - frame $id.3_5rangef - pack $id.3_5rangef -side top - label $id.3_5rangef.lfont -text "Font :" - entry $id.3_5rangef.font -textvariable $var_graph_font -width 30 - pack $id.3_5rangef.lfont $id.3_5rangef.font -side left - - frame $id.4rangef - pack $id.4rangef -side top - label $id.4rangef.lbgcolor -text "Background Color :" - entry $id.4rangef.bgcolor -textvariable $var_graph_bgcolor -width 7 - pack $id.4rangef.lbgcolor $id.4rangef.bgcolor -side left - - frame $id.5rangef - pack $id.5rangef -side top - label $id.5rangef.lsbcolor -text "Scroll Bar Color :" - entry $id.5rangef.sbcolor -textvariable $var_graph_sbcolor -width 7 - pack $id.5rangef.lsbcolor $id.5rangef.sbcolor -side left - - frame $id.6rangef - pack $id.6rangef -side top - label $id.6rangef.lfgcolor -text "Foreground Color :" - entry $id.6rangef.fgcolor -textvariable $var_graph_fgcolor -width 7 - pack $id.6rangef.lfgcolor $id.6rangef.fgcolor -side left - - frame $id.7rangef - pack $id.7rangef -side top - label $id.7rangef.lsecolor -text "Selection Color :" - entry $id.7rangef.secolor -textvariable $var_graph_secolor -width 7 - pack $id.7rangef.lsecolor $id.7rangef.secolor -side left - - bind $id.1rangef.extension [concat playlist_ok $id] - bind $id.2rangef.width [concat playlist_ok $id] - bind $id.3rangef.height [concat playlist_ok $id] - bind $id.3_5rangef.font [concat playlist_ok $id] - bind $id.4rangef.bgcolor [concat playlist_ok $id] - bind $id.5rangef.sbcolor [concat playlist_ok $id] - bind $id.6rangef.fgcolor [concat playlist_ok $id] - bind $id.7rangef.secolor [concat playlist_ok $id] -} - -############ playlist procedures END -- ydegoyon@free.fr ######### diff --git a/playlist/playlist.tk2c b/playlist/playlist.tk2c deleted file mode 100644 index 8058827..0000000 --- a/playlist/playlist.tk2c +++ /dev/null @@ -1,123 +0,0 @@ -// ########### playlist procedures -- ydegoyon@free.fr ######### -sys_gui("proc playlist_apply {id} {\n"); -// strip "." from the TK id to make a variable name suffix -sys_gui("set vid [string trimleft $id .]\n"); -// for each variable, make a local variable to hold its name... -sys_gui("set var_graph_extension [concat graph_extension_$vid]\n"); -sys_gui("global $var_graph_extension\n"); -sys_gui("set var_graph_width [concat graph_width_$vid]\n"); -sys_gui("global $var_graph_width\n"); -sys_gui("set var_graph_height [concat graph_height$vid]\n"); -sys_gui("global $var_graph_height\n"); -sys_gui("set var_graph_font [concat graph_font$vid]\n"); -sys_gui("global $var_graph_font\n"); -sys_gui("set var_graph_bgcolor [concat graph_bgcolor$vid]\n"); -sys_gui("global $var_graph_bgcolor\n"); -sys_gui("set var_graph_sbcolor [concat graph_sbcolor$vid]\n"); -sys_gui("global $var_graph_sbcolor\n"); -sys_gui("set var_graph_fgcolor [concat graph_fgcolor$vid]\n"); -sys_gui("global $var_graph_fgcolor\n"); -sys_gui("set var_graph_secolor [concat graph_secolor$vid]\n"); -sys_gui("global $var_graph_secolor\n"); -sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_extension] [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_font] [eval concat $$var_graph_bgcolor] [eval concat $$var_graph_sbcolor] [eval concat $$var_graph_fgcolor] [eval concat $$var_graph_secolor] \\;]\n"); -// puts stderr $cmd -sys_gui("pd $cmd\n"); -sys_gui("}\n"); -sys_gui("proc playlist_cancel {id} {\n"); -sys_gui("set cmd [concat $id cancel \\;]\n"); -// puts stderr $cmd -sys_gui("pd $cmd\n"); -sys_gui("}\n"); -sys_gui("proc playlist_ok {id} {\n"); -sys_gui("playlist_apply $id\n"); -sys_gui("playlist_cancel $id\n"); -sys_gui("}\n"); -sys_gui("proc pdtk_playlist_dialog {id extension width height font bgcolor sbcolor fgcolor secolor} {\n"); -sys_gui("set vid [string trimleft $id .]\n"); -sys_gui("set var_graph_extension [concat graph_extension_$vid]\n"); -sys_gui("global $var_graph_extension\n"); -sys_gui("set var_graph_width [concat graph_width_$vid]\n"); -sys_gui("global $var_graph_width\n"); -sys_gui("set var_graph_height [concat graph_height$vid]\n"); -sys_gui("global $var_graph_height\n"); -sys_gui("set var_graph_font [concat graph_font$vid]\n"); -sys_gui("global $var_graph_font\n"); -sys_gui("set var_graph_bgcolor [concat graph_bgcolor$vid]\n"); -sys_gui("global $var_graph_bgcolor\n"); -sys_gui("set var_graph_sbcolor [concat graph_sbcolor$vid]\n"); -sys_gui("global $var_graph_sbcolor\n"); -sys_gui("set var_graph_fgcolor [concat graph_fgcolor$vid]\n"); -sys_gui("global $var_graph_fgcolor\n"); -sys_gui("set var_graph_secolor [concat graph_secolor$vid]\n"); -sys_gui("global $var_graph_secolor\n"); -sys_gui("set $var_graph_extension $extension\n"); -sys_gui("set $var_graph_width $width\n"); -sys_gui("set $var_graph_height $height\n"); -sys_gui("set $var_graph_font $font\n"); -sys_gui("set $var_graph_bgcolor $bgcolor\n"); -sys_gui("set $var_graph_sbcolor $sbcolor\n"); -sys_gui("set $var_graph_fgcolor $fgcolor\n"); -sys_gui("set $var_graph_secolor $secolor\n"); -sys_gui("toplevel $id\n"); -sys_gui("wm title $id {playlist}\n"); -sys_gui("wm protocol $id WM_DELETE_WINDOW [concat playlist_cancel $id]\n"); -sys_gui("label $id.label -text {PLAYLIST PROPERTIES}\n"); -sys_gui("pack $id.label -side top\n"); -sys_gui("frame $id.buttonframe\n"); -sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n"); -sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"playlist_cancel $id\"\n"); -sys_gui("button $id.buttonframe.apply -text {Apply} -command \"playlist_apply $id\"\n"); -sys_gui("button $id.buttonframe.ok -text {OK} -command \"playlist_ok $id\"\n"); -sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n"); -sys_gui("pack $id.buttonframe.apply -side left -expand 1\n"); -sys_gui("pack $id.buttonframe.ok -side left -expand 1\n"); -sys_gui("frame $id.1rangef\n"); -sys_gui("pack $id.1rangef -side top\n"); -sys_gui("label $id.1rangef.lextension -text \"Files Extension :\"\n"); -sys_gui("entry $id.1rangef.extension -textvariable $var_graph_extension -width 7\n"); -sys_gui("pack $id.1rangef.lextension $id.1rangef.extension -side left\n"); -sys_gui("frame $id.2rangef\n"); -sys_gui("pack $id.2rangef -side top\n"); -sys_gui("label $id.2rangef.lwidth -text \"Width :\"\n"); -sys_gui("entry $id.2rangef.width -textvariable $var_graph_width -width 7\n"); -sys_gui("pack $id.2rangef.lwidth $id.2rangef.width -side left\n"); -sys_gui("frame $id.3rangef\n"); -sys_gui("pack $id.3rangef -side top\n"); -sys_gui("label $id.3rangef.lheight -text \"Height :\"\n"); -sys_gui("entry $id.3rangef.height -textvariable $var_graph_height -width 7\n"); -sys_gui("pack $id.3rangef.lheight $id.3rangef.height -side left\n"); -sys_gui("frame $id.3_5rangef\n"); -sys_gui("pack $id.3_5rangef -side top\n"); -sys_gui("label $id.3_5rangef.lfont -text \"Font :\"\n"); -sys_gui("entry $id.3_5rangef.font -textvariable $var_graph_font -width 30\n"); -sys_gui("pack $id.3_5rangef.lfont $id.3_5rangef.font -side left\n"); -sys_gui("frame $id.4rangef\n"); -sys_gui("pack $id.4rangef -side top\n"); -sys_gui("label $id.4rangef.lbgcolor -text \"Background Color :\"\n"); -sys_gui("entry $id.4rangef.bgcolor -textvariable $var_graph_bgcolor -width 7\n"); -sys_gui("pack $id.4rangef.lbgcolor $id.4rangef.bgcolor -side left\n"); -sys_gui("frame $id.5rangef\n"); -sys_gui("pack $id.5rangef -side top\n"); -sys_gui("label $id.5rangef.lsbcolor -text \"Scroll Bar Color :\"\n"); -sys_gui("entry $id.5rangef.sbcolor -textvariable $var_graph_sbcolor -width 7\n"); -sys_gui("pack $id.5rangef.lsbcolor $id.5rangef.sbcolor -side left\n"); -sys_gui("frame $id.6rangef\n"); -sys_gui("pack $id.6rangef -side top\n"); -sys_gui("label $id.6rangef.lfgcolor -text \"Foreground Color :\"\n"); -sys_gui("entry $id.6rangef.fgcolor -textvariable $var_graph_fgcolor -width 7\n"); -sys_gui("pack $id.6rangef.lfgcolor $id.6rangef.fgcolor -side left\n"); -sys_gui("frame $id.7rangef\n"); -sys_gui("pack $id.7rangef -side top\n"); -sys_gui("label $id.7rangef.lsecolor -text \"Selection Color :\"\n"); -sys_gui("entry $id.7rangef.secolor -textvariable $var_graph_secolor -width 7\n"); -sys_gui("pack $id.7rangef.lsecolor $id.7rangef.secolor -side left\n"); -sys_gui("bind $id.1rangef.extension [concat playlist_ok $id]\n"); -sys_gui("bind $id.2rangef.width [concat playlist_ok $id]\n"); -sys_gui("bind $id.3rangef.height [concat playlist_ok $id]\n"); -sys_gui("bind $id.3_5rangef.font [concat playlist_ok $id]\n"); -sys_gui("bind $id.4rangef.bgcolor [concat playlist_ok $id]\n"); -sys_gui("bind $id.5rangef.sbcolor [concat playlist_ok $id]\n"); -sys_gui("bind $id.6rangef.fgcolor [concat playlist_ok $id]\n"); -sys_gui("bind $id.7rangef.secolor [concat playlist_ok $id]\n"); -sys_gui("}\n"); -// ########### playlist procedures END -- ydegoyon@free.fr ######### diff --git a/playlist/tk2c.bash b/playlist/tk2c.bash deleted file mode 100755 index 9dfeb03..0000000 --- a/playlist/tk2c.bash +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -#set -x - -while read line -do - for word in $line - do - if [ "X"$word != "X"${word#\#} ] - then - echo // ${line#\#} - break - else - line=${line//\'/\\\'} -#useless, slashes never gets in - line=${line//\\/\\\\} -#this one's dirty, i know - line=${line//;/\\\\;} - line=${line//\"/\\\"} - echo 'sys_gui("'$line'\n");' - break - fi - done -done diff --git a/playlist/xmms.pd b/playlist/xmms.pd deleted file mode 100644 index b9282cd..0000000 --- a/playlist/xmms.pd +++ /dev/null @@ -1,144 +0,0 @@ -#N canvas 146 29 755 574 10; -#X obj 411 144 mp3fileout~; -#X floatatom 411 165 5 0 0; -#X floatatom 456 165 5 0 0; -#X msg 409 113 open \$1; -#X msg 466 113 start; -#X msg 511 114 stop; -#X text 534 154 Number of frames emitted; -#X text 396 184 Connection state; -#X symbolatom 127 286 80 0 0; -#X floatatom 520 63 5 0 0; -#X obj 20 57 playlist mp3 300 200; -#X msg 651 37 bang; -#X text 23 17 Step 1 : point to your MP3s directory; -#X obj 357 513 dac~; -#X symbolatom 131 438 10 0 0; -#X text 127 452 Incomer's address; -#X obj 349 470 *~ 1; -#X floatatom 461 513 5 0 0; -#X obj 427 513 / 100; -#X obj 390 470 *~ 1; -#X text 501 515 Volume; -#X msg 336 38 connect localhost 5672; -#X obj 95 341 mp3streamin~ 5672 1; -#X text 295 15 Step 2 : connect to the streamer; -#X text 65 285 Playing :; -#X msg 463 64 seek \$1; -#X text 566 11 Step 3 :start random play; -#X obj 657 410 loadbang; -#X msg 656 434 \; pd dsp 1; -#X msg 379 220 seek \$1; -#X obj 437 219 hsl 128 15 0 1e+07 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 0 0; -#X msg 547 114 disconnect; -#X obj 573 37 random 1000; -#X msg 620 73 seed \$1; -#X floatatom 673 73 5 0 0; -#X msg 634 220 bang; -#X text 575 264 Step 3 bis :start seq play; -#X obj 592 220 countn; -#X obj 578 242 - 1; -#X floatatom 531 243 5 0 0; -#X obj 551 187 spigot; -#X obj 599 186 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 -1; -#X msg 624 186 1; -#X obj 618 95 spigot; -#X obj 666 94 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 1 -; -#X msg 691 94 1; -#X obj 362 441 ekwalizer --------------------------; -#X msg 544 315 100; -#X obj 385 343 vsl 15 80 0 100 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 7900 1; -#X obj 408 343 vsl 15 80 0 100 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 7900 1; -#X obj 432 343 vsl 15 80 0 100 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 7900 1; -#X obj 454 343 vsl 15 80 0 100 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 7900 1; -#X obj 477 343 vsl 15 80 0 100 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 0 1; -#X obj 498 343 vsl 15 80 0 100 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 0 1; -#X obj 516 343 vsl 15 80 0 100 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 0 1; -#X obj 534 343 vsl 15 80 0 100 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 0 1; -#X obj 552 343 vsl 15 80 0 100 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 0 1; -#X obj 573 343 vsl 15 80 0 100 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 0 1; -#X obj 579 315 loadbang; -#X obj 494 539 loadbang; -#X msg 463 539 50; -#X obj 259 486 compressor~; -#X floatatom 279 434 5 0 0; -#X obj 241 509 env~; -#X obj 266 463 / 100; -#X connect 0 0 1 0; -#X connect 0 1 2 0; -#X connect 0 2 40 0; -#X connect 0 2 43 0; -#X connect 3 0 0 0; -#X connect 4 0 0 0; -#X connect 5 0 0 0; -#X connect 10 0 8 0; -#X connect 10 0 3 0; -#X connect 11 0 32 0; -#X connect 11 0 45 0; -#X connect 16 0 61 0; -#X connect 17 0 18 0; -#X connect 18 0 16 1; -#X connect 18 0 19 1; -#X connect 19 0 61 0; -#X connect 21 0 0 0; -#X connect 21 0 4 0; -#X connect 22 0 46 0; -#X connect 22 1 46 0; -#X connect 22 2 14 0; -#X connect 25 0 10 0; -#X connect 27 0 28 0; -#X connect 29 0 0 0; -#X connect 30 0 29 0; -#X connect 31 0 0 0; -#X connect 32 0 9 0; -#X connect 32 0 25 0; -#X connect 33 0 32 0; -#X connect 34 0 33 0; -#X connect 35 0 37 0; -#X connect 35 0 42 0; -#X connect 37 0 38 0; -#X connect 38 0 25 0; -#X connect 38 0 39 0; -#X connect 40 0 37 0; -#X connect 41 0 40 1; -#X connect 42 0 41 0; -#X connect 43 0 32 0; -#X connect 44 0 43 1; -#X connect 45 0 44 0; -#X connect 46 0 19 0; -#X connect 46 0 16 0; -#X connect 47 0 48 0; -#X connect 47 0 49 0; -#X connect 47 0 50 0; -#X connect 47 0 51 0; -#X connect 48 0 46 1; -#X connect 49 0 46 2; -#X connect 50 0 46 3; -#X connect 51 0 46 4; -#X connect 52 0 46 5; -#X connect 53 0 46 6; -#X connect 54 0 46 7; -#X connect 55 0 46 8; -#X connect 56 0 46 9; -#X connect 57 0 46 10; -#X connect 58 0 47 0; -#X connect 59 0 60 0; -#X connect 60 0 17 0; -#X connect 61 0 13 0; -#X connect 61 0 13 1; -#X connect 61 0 63 0; -#X connect 62 0 64 0; -#X connect 64 0 61 1; -- cgit v1.2.1