aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN.N. <sevyves@users.sourceforge.net>2004-03-30 03:59:41 +0000
committerN.N. <sevyves@users.sourceforge.net>2004-03-30 03:59:41 +0000
commitf51c45c93c6bdc6601465c49c9c6c19c5bde7e63 (patch)
tree6ca5b7f0c5d84086fe6bc59ee3feec471cd17b95
parent0ba839b86723c2a2c459f81de3f84fc10dcc8ec5 (diff)
playlist 0.8
svn path=/trunk/externals/unauthorized/; revision=1513
-rw-r--r--playlist/CHANGES.LOG6
-rw-r--r--playlist/Makefile2
-rw-r--r--playlist/help-playlist.pd48
-rw-r--r--playlist/playlist.c396
-rw-r--r--playlist/playlist.tk75
-rw-r--r--playlist/playlist.tk2c123
-rwxr-xr-xplaylist/tk2c.bash24
7 files changed, 558 insertions, 116 deletions
diff --git a/playlist/CHANGES.LOG b/playlist/CHANGES.LOG
index 1b8b586..5f575ea 100644
--- a/playlist/CHANGES.LOG
+++ b/playlist/CHANGES.LOG
@@ -1,3 +1,9 @@
+0.8
+ added colors and font properties
+ added a "font" message
+ added a "sort" message ( using alphabetical or creation order )
+0.7
+ adapted for pd 0.37
0.6
added properties menu
0.5
diff --git a/playlist/Makefile b/playlist/Makefile
index 5bc42ec..af34a23 100644
--- a/playlist/Makefile
+++ b/playlist/Makefile
@@ -67,7 +67,7 @@ LINUXCFLAGS = -DPD -DUNIX -O2 -funroll-loops -fomit-frame-pointer \
LINUXINCLUDE = -I../../src
.c.pd_linux:
- ../tk2c.bash < $*.tk > $*.tk2c
+ ./tk2c.bash < $*.tk > $*.tk2c
gcc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
strip --strip-unneeded $*.pd_linux
diff --git a/playlist/help-playlist.pd b/playlist/help-playlist.pd
new file mode 100644
index 0000000..76fdbb9
--- /dev/null
+++ b/playlist/help-playlist.pd
@@ -0,0 +1,48 @@
+#N canvas 94 79 817 563 10;
+#X text 28 57 Constructor : playlist <extension> <width> <height>;
+#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 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 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;
+#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 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 msg 300 136 font Helvetica normal 14;
+#X msg 458 135 font Courier bold 24;
+#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;
diff --git a/playlist/playlist.c b/playlist/playlist.c
index aae284d..2bbbc00 100644
--- a/playlist/playlist.c
+++ b/playlist/playlist.c
@@ -35,7 +35,7 @@
#include <math.h>
#include <ctype.h>
#include <regex.h>
-#include <m_pd.h>
+#include "m_pd.h"
#include "m_imp.h"
#include "g_canvas.h"
#include "t_tk.h"
@@ -53,9 +53,8 @@ static t_class *playlist_class;
static int guidebug=0;
-static char *playlist_version = "playlist: 1 click file chooser : version 0.6, written by Yves Degoyon (ydegoyon@free.fr)";
+static char *playlist_version = "playlist: 1 click file chooser : version 0.8, written by Yves Degoyon (ydegoyon@free.fr)";
-#define CHAR_WIDTH 6 // average character width with font Helvetica 8
#define MAX_DIR_LENGTH 2048 // maximum length for a directory name
#define MIN(a,b) (a>b?b:a)
@@ -92,6 +91,14 @@ static char *playlist_version = "playlist: 1 click file chooser : version 0.6,
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
{
@@ -111,7 +118,15 @@ typedef struct _playlist
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;
@@ -123,13 +138,14 @@ static void playlist_update_dir(t_playlist *x, t_glist *glist)
// set title
SYS_VGUI3(".x%x.c delete %xTITLE\n", glist_getcanvas(glist), x);
- SYS_VGUI7(".x%x.c create text %d %d -width %d -text \"%s\" \
- -anchor w -font {Helvetica 8 bold} -tags %xTITLE\n",
+ 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,
+ x->x_font,
x );
// delete previous entries
@@ -144,7 +160,7 @@ static void playlist_update_dir(t_playlist *x, t_glist *glist)
struct dirent** dentries; /* all directory entries */
// post( "playlist : scandir : %s", x->x_curdir );
- if ( ( nentries = scandir(x->x_curdir, &dentries, NULL, alphasort ) ) == -1 )
+ 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" );
@@ -195,18 +211,21 @@ static void playlist_update_dir(t_playlist *x, t_glist *glist)
strcpy( x->x_dentries[x->x_nentries], dentries[i]->d_name );
// display the entry if displayable
- if ( x->x_nentries*10+5 < x->x_height )
+ 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/CHAR_WIDTH, MAX_DIR_LENGTH) );
- wrappedname[ x->x_width/CHAR_WIDTH ] = '\0';
- SYS_VGUI8(".x%x.c create text %d %d -fill #000000 -activefill #FF0000 -width %d -text \"%s\" \
- -anchor w -font {Helvetica 8 bold} -tags %xENTRY%d\n",
+ 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)*10,
+ x->x_obj.te_ypix+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++;
@@ -231,18 +250,44 @@ void playlist_output_current(t_playlist* x)
}
}
+void playlist_sort(t_playlist* x, t_floatarg fsort)
+{
+ if ( ( (t_int)fsort != 0 ) && ( (t_int)fsort != 1 ) )
+ {
+ post( "plyalist : wrong argument to playlist message : %d", (t_int)fsort );
+ return;
+ }
+
+ x->x_sort = (t_int) fsort;
+ playlist_update_dir( x, x->x_glist );
+}
+
+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, (t_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 );
+}
+
void playlist_draw_new(t_playlist *x, t_glist *glist)
{
t_canvas *canvas=glist_getcanvas(glist);
- SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #457782 -tags %xPLAYLIST\n",
+ 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);
- SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill yellow -tags %xSCROLLLIST\n",
+ 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->x_sbcolor, x);
playlist_update_dir( x, glist );
@@ -271,7 +316,7 @@ void playlist_draw_move(t_playlist *x, t_glist *glist)
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)*10);
+ x->x_obj.te_ypix+5+(i-x->x_firstseen)*x->x_charheight);
}
canvas_fixlinesfor( canvas, (t_text*)x );
@@ -326,9 +371,11 @@ 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, "ssiissii", gensym("#X"),gensym("obj"),
+ 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("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, ";");
}
@@ -388,7 +435,7 @@ void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
{
// eventually, move down
if ( ( x->x_cdy >= 3 ) &&
- ( x->x_firstseen < x->x_nentries - ( x->x_height/10 ) ) )
+ ( x->x_firstseen < x->x_nentries - ( x->x_height/x->x_charheight ) ) )
{
x->x_cdy = 0;
if ( x->x_firstseen + 1 < x->x_nentries )
@@ -402,29 +449,33 @@ void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
{
char *wrappedname = (char *) getbytes( x->x_width );
- if ( (i-x->x_firstseen)*10+5 < x->x_height )
+ 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/CHAR_WIDTH );
- wrappedname[ x->x_width/CHAR_WIDTH ] = '\0';
- SYS_VGUI8(".x%x.c create text %d %d -fill #000000 -activefill #FF0000 -width %d -text \"%s\" \
- -anchor w -font {Helvetica 8 bold} -tags %xENTRY%d\n",
+ 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)*10,
+ x->x_obj.te_ypix+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_VGUI4(".x%x.c itemconfigure %xENTRY%d -fill #FF0000\n", x->x_glist, x, x->x_itemselected);
+ 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 );
}
}
// eventually, move up
if ( ( x->x_cdy <= -3 ) &&
- ( x->x_lastseen >= ( x->x_height/10 ) ) )
+ ( x->x_lastseen >= ( x->x_height/x->x_charheight ) ) )
{
x->x_cdy = 0;
if ( x->x_firstseen - 1 >= 0 )
@@ -438,23 +489,27 @@ void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
{
char *wrappedname = (char *) getbytes( x->x_width );
- if ( (i-x->x_firstseen)*10+5 < x->x_height )
+ 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/CHAR_WIDTH );
- wrappedname[ x->x_width/CHAR_WIDTH ] = '\0';
- SYS_VGUI8(".x%x.c create text %d %d -fill #000000 -activefill #FF0000 -width %d -text \"%s\" \
- -anchor w -font {Helvetica 8 bold} -tags %xENTRY%d\n",
+ 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)*10,
+ x->x_obj.te_ypix+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_VGUI4(".x%x.c itemconfigure %xENTRY%d -fill #FF0000\n", x->x_glist, x, x->x_itemselected);
+ 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 );
}
}
@@ -473,9 +528,11 @@ int playlist_click(t_gobj *z, struct _glist *glist,
if ( (xpix-x->x_obj.te_xpix) < 4*x->x_width/5 )
{
// deselect previously selected item
- SYS_VGUI4(".x%x.c itemconfigure %xENTRY%d -fill #000000\n", x->x_glist, x, x->x_itemselected);
- x->x_itemselected = x->x_firstseen + (ypix-x->x_obj.te_ypix)/10;
- SYS_VGUI4(".x%x.c itemconfigure %xENTRY%d -fill #FF0000\n", x->x_glist, x, x->x_itemselected);
+ 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 ) )
{
@@ -537,8 +594,10 @@ 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\n",
- x->x_extension, x->x_width, x->x_height);
+ sprintf(buf, "pdtk_playlist_dialog %%s %s %d %d %s %s %s %s %s\n",
+ x->x_extension, x->x_width, 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);
}
@@ -548,80 +607,177 @@ 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 != 3 )
+ if ( argc != 10 )
{
- post( "playlist : error in the number of arguments ( %d instead of 3 )", argc );
+ 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 ) {
+ 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,
+ (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;
+ 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);
}
-t_playlist *playlist_new(t_symbol *extension, t_floatarg fwidth, t_floatarg fheight )
+t_playlist *playlist_new(t_symbol *s, int argc, t_atom *argv )
{
- int i;
- t_playlist *x;
- char *tmpcurdir;
-
- if ( !strcmp( extension->s_name, "" ) )
- {
- error( "playlist : no extension specified" );
- error( "playlist : usage : playlist <extension> <width> <height>" );
- return NULL;
- }
-
- if ( fwidth <= 0 )
- {
- error( "playlist : wrong width (%d)", fwidth );
- error( "playlist : usage : playlist <extension> <width> <height>" );
- return NULL;
- }
-
- if ( fheight <= 0 )
- {
- error( "playlist : wrong height (%d)", fheight );
- error( "playlist : usage : playlist <extension> <width> <height>" );
- return NULL;
- }
-
- x = (t_playlist *)pd_new(playlist_class);
+ t_int i;
+ 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 <extension> <width> <height>" );
+ 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 <extension> <width> <height>" );
+ 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 <extension> <width> <height>" );
+ return NULL;
+ }
+ x->x_height = (int)argv[2].a_w.w_float;
+ }
+ if ( argc >= 6 )
+ {
+ if ( argv[3].a_type != A_SYMBOL || argv[4].a_type != A_FLOAT ||
+ argv[5].a_type != A_SYMBOL )
+ {
+ error( "playlist : wrong arguments (font : 4,5,6)" );
+ 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 ( argc >= 7 )
+ {
+ if ( argv[6].a_type != A_SYMBOL )
+ {
+ error( "playlist : wrong arguments (background color : 7)" );
+ return NULL;
+ }
+ strcpy( x->x_bgcolor, argv[6].a_w.w_symbol->s_name );
+ }
+ if ( argc >= 8 )
+ {
+ if ( argv[7].a_type != A_SYMBOL )
+ {
+ error( "playlist : wrong arguments (scrollbar color : 8)" );
+ return NULL;
+ }
+ strcpy( x->x_sbcolor, argv[7].a_w.w_symbol->s_name );
+ }
+ if ( argc >= 9 )
+ {
+ if ( argv[8].a_type != A_SYMBOL )
+ {
+ error( "playlist : wrong arguments (foreground color : 9)" );
+ return NULL;
+ }
+ strcpy( x->x_fgcolor, argv[8].a_w.w_symbol->s_name );
+ }
+ if ( argc >= 10 )
+ {
+ if ( argv[9].a_type != A_SYMBOL )
+ {
+ error( "playlist : wrong arguments (selection color : 10)" );
+ return NULL;
+ }
+ strcpy( x->x_secolor, argv[9].a_w.w_symbol->s_name );
+ }
- x->x_width = fwidth;
- x->x_height = fheight;
- x->x_extension = ( char * ) getbytes( strlen( extension->s_name ) + 2 );
- sprintf( x->x_extension, "%s", extension->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_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;
- 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 );
+ if ( ( tmpcurdir = getenv( "PWD" ) ) == 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';
- // get current directory full path
- x->x_curdir = ( char * ) getbytes( MAX_DIR_LENGTH );
- if ( ( tmpcurdir = getenv( "PWD" ) ) == 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_selected = 0;
- x->x_itemselected = -1;
+ x->x_sort = 1;
// post( "playlist : built extension=%s width=%d height=%d", x->x_extension, x->x_width, x->x_height );
@@ -633,12 +789,32 @@ void playlist_free(t_playlist *x)
// post( "playlist : playlist_free" );
if ( x->x_extension )
{
- freebytes( x->x_extension, strlen( 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 );
+ }
}
void playlist_seek(t_playlist *x, t_floatarg fseeked)
@@ -660,9 +836,10 @@ void playlist_seek(t_playlist *x, t_floatarg fseeked)
{
return;
}
- SYS_VGUI4(".x%x.c itemconfigure %xENTRY%d -fill #000000\n", x->x_glist, x, x->x_itemselected);
+ 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_VGUI4(".x%x.c itemconfigure %xENTRY%d -fill #FF0000\n", x->x_glist, x, x->x_itemselected);
+ 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);
}
@@ -730,10 +907,13 @@ void playlist_setup(void)
#include "playlist.tk2c"
playlist_class = class_new(gensym("playlist"), (t_newmethod)playlist_new,
(t_method)playlist_free, sizeof(t_playlist),
- CLASS_DEFAULT, A_SYMBOL, A_FLOAT, A_FLOAT, 0);
- class_addmethod(playlist_class, (t_method)playlist_seek, gensym("seek"), A_FLOAT, 0 );
- class_addmethod(playlist_class, (t_method)playlist_location, gensym("location"), A_SYMBOL, 0 );
- class_addmethod(playlist_class, (t_method)playlist_dialog, gensym("dialog"), A_GIMME, 0 );
+ 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_font, gensym("font"), A_SYMBOL,
+ A_SYMBOL, A_DEFFLOAT, A_NULL );
playlist_widgetbehavior.w_getrectfn = playlist_getrect;
playlist_widgetbehavior.w_displacefn = playlist_displace;
@@ -742,19 +922,15 @@ void playlist_setup(void)
playlist_widgetbehavior.w_deletefn = playlist_delete;
playlist_widgetbehavior.w_visfn = playlist_vis;
playlist_widgetbehavior.w_clickfn = playlist_click;
- /*
- * <hans@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)
+
+#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;
-#else
- class_setsavefn(playlist_class, &playlist_save);
- class_setpropertiesfn(playlist_class, &playlist_properties);
#endif
class_setwidget(playlist_class, &playlist_widgetbehavior);
+ class_sethelpsymbol(playlist_class, gensym("playlist.pd"));
}
diff --git a/playlist/playlist.tk b/playlist/playlist.tk
index 025c312..5a22a05 100644
--- a/playlist/playlist.tk
+++ b/playlist/playlist.tk
@@ -10,11 +10,26 @@ proc playlist_apply {id} {
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
@@ -31,7 +46,7 @@ proc playlist_ok {id} {
playlist_cancel $id
}
-proc pdtk_playlist_dialog {id extension width height} {
+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
@@ -39,10 +54,25 @@ proc pdtk_playlist_dialog {id extension width height} {
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_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}
@@ -81,9 +111,44 @@ proc pdtk_playlist_dialog {id extension width 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 <KeyPress-Return> [concat playlist_ok $id]
- bind $id.2rangef.width <KeyPress-Return> [concat playlist_ok $id]
- bind $id.3rangef.height <KeyPress-Return> [concat playlist_ok $id]
+ bind $id.2rangef.width <KeyPress-Return> [concat playlist_ok $id]
+ bind $id.3rangef.height <KeyPress-Return> [concat playlist_ok $id]
+ bind $id.3_5rangef.font <KeyPress-Return> [concat playlist_ok $id]
+ bind $id.4rangef.bgcolor <KeyPress-Return> [concat playlist_ok $id]
+ bind $id.5rangef.sbcolor <KeyPress-Return> [concat playlist_ok $id]
+ bind $id.6rangef.fgcolor <KeyPress-Return> [concat playlist_ok $id]
+ bind $id.7rangef.secolor <KeyPress-Return> [concat playlist_ok $id]
}
############ playlist procedures END -- ydegoyon@free.fr #########
diff --git a/playlist/playlist.tk2c b/playlist/playlist.tk2c
new file mode 100644
index 0000000..8058827
--- /dev/null
+++ b/playlist/playlist.tk2c
@@ -0,0 +1,123 @@
+// ########### 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 <KeyPress-Return> [concat playlist_ok $id]\n");
+sys_gui("bind $id.2rangef.width <KeyPress-Return> [concat playlist_ok $id]\n");
+sys_gui("bind $id.3rangef.height <KeyPress-Return> [concat playlist_ok $id]\n");
+sys_gui("bind $id.3_5rangef.font <KeyPress-Return> [concat playlist_ok $id]\n");
+sys_gui("bind $id.4rangef.bgcolor <KeyPress-Return> [concat playlist_ok $id]\n");
+sys_gui("bind $id.5rangef.sbcolor <KeyPress-Return> [concat playlist_ok $id]\n");
+sys_gui("bind $id.6rangef.fgcolor <KeyPress-Return> [concat playlist_ok $id]\n");
+sys_gui("bind $id.7rangef.secolor <KeyPress-Return> [concat playlist_ok $id]\n");
+sys_gui("}\n");
+// ########### playlist procedures END -- ydegoyon@free.fr #########
diff --git a/playlist/tk2c.bash b/playlist/tk2c.bash
new file mode 100755
index 0000000..9dfeb03
--- /dev/null
+++ b/playlist/tk2c.bash
@@ -0,0 +1,24 @@
+#!/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