aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--playlist/CHANGES.LOG3
-rw-r--r--playlist/help-playlist.pd23
-rw-r--r--playlist/playlist.c77
3 files changed, 66 insertions, 37 deletions
diff --git a/playlist/CHANGES.LOG b/playlist/CHANGES.LOG
index 5f575ea..03f2770 100644
--- a/playlist/CHANGES.LOG
+++ b/playlist/CHANGES.LOG
@@ -1,3 +1,6 @@
+0.9
+ do not output directories ( for clicks and seeks )
+ fixed cut&paste of playlists
0.8
added colors and font properties
added a "font" message
diff --git a/playlist/help-playlist.pd b/playlist/help-playlist.pd
index 76fdbb9..be6334b 100644
--- a/playlist/help-playlist.pd
+++ b/playlist/help-playlist.pd
@@ -3,12 +3,13 @@
#X text 88 95 playlist all 200 200;
#X text 88 107 playlist mp3 200 200;
#X text 30 78 Examples :;
-#X text 80 454 Comments and bugs @ ydegoyon@free.fr;
+#X text 72 507 Comments and bugs @ ydegoyon@free.fr;
#X symbolatom 292 399 50 0 0 0 - - -;
-#X text 17 342 Note : you can scroll the list by dragging;
-#X text 15 353 the mouse in the yellow area;
-#X text 17 364 You can select and scroll in the blue area;
-#X obj 292 181 playlist all 400 200;
+#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 '..');
@@ -20,19 +21,19 @@
#X symbolatom 379 453 50 0 0 0 - - -;
#X msg 151 163 location ..;
#X msg 150 140 location /tmp;
-#X text 60 211 You can change change location;
-#X text 60 221 with a message.;
-#X text 60 233 Thus \, you can initialize the object;
-#X text 59 242 in a particular folder.;
+#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 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 597 135 Change the font;
+#X text 628 136 Change the font;
#X msg 300 136 font Helvetica normal 14;
-#X msg 458 135 font Courier bold 24;
+#X msg 478 136 font Courier bold 24;
#X connect 9 0 5 0;
#X connect 9 1 17 0;
#X connect 9 2 18 0;
diff --git a/playlist/playlist.c b/playlist/playlist.c
index 2bbbc00..b753710 100644
--- a/playlist/playlist.c
+++ b/playlist/playlist.c
@@ -53,7 +53,7 @@ static t_class *playlist_class;
static int guidebug=0;
-static char *playlist_version = "playlist: 1 click file chooser : version 0.8, written by Yves Degoyon (ydegoyon@free.fr)";
+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
@@ -239,6 +239,13 @@ static void playlist_update_dir(t_playlist *x, t_glist *glist)
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 );
@@ -638,7 +645,7 @@ static void playlist_dialog(t_playlist *x, t_symbol *s, int argc, t_atom *argv)
t_playlist *playlist_new(t_symbol *s, int argc, t_atom *argv )
{
- t_int i;
+ t_int i, argoffset=0;
t_playlist *x;
char *tmpcurdir;
@@ -708,51 +715,70 @@ t_playlist *playlist_new(t_symbol *s, int argc, t_atom *argv )
}
if ( argc >= 6 )
{
- if ( argv[3].a_type != A_SYMBOL || argv[4].a_type != A_FLOAT ||
+ if ( argv[3].a_type != A_SYMBOL ||
argv[5].a_type != A_SYMBOL )
{
- error( "playlist : wrong arguments (font : 4,5,6)" );
+ 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;
}
- sprintf( x->x_font, "%s %d %s", argv[3].a_w.w_symbol->s_name,
- (t_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;
+ 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,
+ 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 )
+ if ( argc >= 7-argoffset )
{
- if ( argv[6].a_type != A_SYMBOL )
+ if ( argv[6-argoffset].a_type != A_SYMBOL )
{
- error( "playlist : wrong arguments (background color : 7)" );
+ error( "playlist : wrong arguments (background color : %d)", 7-argoffset );
return NULL;
}
- strcpy( x->x_bgcolor, argv[6].a_w.w_symbol->s_name );
+ strcpy( x->x_bgcolor, argv[6-argoffset].a_w.w_symbol->s_name );
}
- if ( argc >= 8 )
+ if ( argc >= 8-argoffset )
{
- if ( argv[7].a_type != A_SYMBOL )
+ if ( argv[7-argoffset].a_type != A_SYMBOL )
{
- error( "playlist : wrong arguments (scrollbar color : 8)" );
+ error( "playlist : wrong arguments (scrollbar color : %d)", 8-argoffset );
return NULL;
}
- strcpy( x->x_sbcolor, argv[7].a_w.w_symbol->s_name );
+ strcpy( x->x_sbcolor, argv[7-argoffset].a_w.w_symbol->s_name );
}
- if ( argc >= 9 )
+ if ( argc >= 9-argoffset )
{
- if ( argv[8].a_type != A_SYMBOL )
+ if ( argv[8-argoffset].a_type != A_SYMBOL )
{
- error( "playlist : wrong arguments (foreground color : 9)" );
+ error( "playlist : wrong arguments (foreground color : %d)", 9-argoffset );
return NULL;
}
- strcpy( x->x_fgcolor, argv[8].a_w.w_symbol->s_name );
+ strcpy( x->x_fgcolor, argv[8-argoffset].a_w.w_symbol->s_name );
}
- if ( argc >= 10 )
+ if ( argc >= 10-argoffset )
{
- if ( argv[9].a_type != A_SYMBOL )
+ if ( argv[9-argoffset].a_type != A_SYMBOL )
{
- error( "playlist : wrong arguments (selection color : 10)" );
+ error( "playlist : wrong arguments (selection color : %d)", 10-argoffset );
return NULL;
}
- strcpy( x->x_secolor, argv[9].a_w.w_symbol->s_name );
+ strcpy( x->x_secolor, argv[9-argoffset].a_w.w_symbol->s_name );
}
x->x_fullpath = outlet_new(&x->x_obj, &s_symbol );
@@ -781,7 +807,7 @@ t_playlist *playlist_new(t_symbol *s, int argc, t_atom *argv )
// post( "playlist : built extension=%s width=%d height=%d", x->x_extension, x->x_width, x->x_height );
- return (x);
+ return (x);
}
void playlist_free(t_playlist *x)
@@ -838,8 +864,7 @@ void playlist_seek(t_playlist *x, t_floatarg fseeked)
}
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);
+ 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);
}