diff options
author | N.N. <krzyszcz@users.sourceforge.net> | 2005-01-27 14:42:55 +0000 |
---|---|---|
committer | N.N. <krzyszcz@users.sourceforge.net> | 2005-01-27 14:42:55 +0000 |
commit | bfb359fd22e61faaca3a6e49ad3b7a81f2d71551 (patch) | |
tree | d070071515c7e7f53073da32046b24855e8307c8 /cyclone/sickle/sickle.c | |
parent | 6435314717c5fb8fa062eb682c72c8df095b1be3 (diff) |
cyclone alpha52 and toxy alpha15 (see notes.txt for cyclone, toxy and shared)
svn path=/trunk/externals/miXed/; revision=2550
Diffstat (limited to 'cyclone/sickle/sickle.c')
-rw-r--r-- | cyclone/sickle/sickle.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/cyclone/sickle/sickle.c b/cyclone/sickle/sickle.c index 1d46050..c83f543 100644 --- a/cyclone/sickle/sickle.c +++ b/cyclone/sickle/sickle.c @@ -13,8 +13,6 @@ void allsickles_setup(void); typedef struct _sickle { t_object x_ob; - t_symbol *x_dir; - t_symbol *x_canvasdir; t_hammerfile *x_filehandle; } t_sickle; @@ -24,39 +22,43 @@ static int sickle_lastndx; static void sickle_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) { - import_max(fn->s_name, ""); + int result = import_max(fn->s_name, ""); + outlet_float(((t_object *)z)->ob_outlet, (t_float)result); } -static void sickle_doimport(t_sickle *x, t_symbol *fn, t_symbol *dir) +static void sickle_doimport(t_sickle *x, t_symbol *fn) { - if (!dir || dir == &s_) - dir = x->x_dir; if (fn && fn != &s_) - import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : ""); - else - hammerpanel_open(x->x_filehandle, dir); + { + t_symbol *dir = hammerpanel_getopendir(x->x_filehandle); + int result = + import_max(fn->s_name, (dir && dir != &s_ ? dir->s_name : "")); + outlet_float(((t_object *)x)->ob_outlet, (t_float)result); + } + else hammerpanel_open(x->x_filehandle, 0); } static void sickle_click(t_sickle *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { - sickle_doimport(x, 0, 0); + sickle_doimport(x, 0); } static void sickle_import(t_sickle *x, t_symbol *fn) { - sickle_doimport(x, fn, 0); + sickle_doimport(x, fn); } static void sickle_cd(t_sickle *x, t_symbol *dir) { - /* LATER hammerfile interface for relative jumps, etc. */ - x->x_dir = (dir && dir != &s_ ? dir : x->x_canvasdir); + hammerpanel_setopendir(x->x_filehandle, dir); } -static void sickle_pwd(t_sickle *x) +static void sickle_pwd(t_sickle *x, t_symbol *s) { - outlet_symbol(((t_object *)x)->ob_outlet, x->x_dir); + t_symbol *dir; + if (s && s->s_thing && (dir = hammerpanel_getopendir(x->x_filehandle))) + pd_symbol(s->s_thing, dir); } static void sickle_bang(t_sickle *x) @@ -74,9 +76,7 @@ static void *sickle_new(void) { t_sickle *x = (t_sickle *)pd_new(sickle_class); x->x_filehandle = hammerfile_new((t_pd *)x, 0, sickle_readhook, 0, 0); - x->x_canvasdir = canvas_getdir(x->x_filehandle->f_canvas); - x->x_dir = x->x_canvasdir; - outlet_new((t_object *)x, &s_symbol); + outlet_new((t_object *)x, &s_float); return (x); } @@ -106,7 +106,7 @@ void sickle_setup(void) class_addmethod(sickle_class, (t_method)sickle_cd, gensym("cd"), A_DEFSYM, 0); class_addmethod(sickle_class, (t_method)sickle_pwd, - gensym("pwd"), 0); + gensym("pwd"), A_SYMBOL, 0); class_addmethod(sickle_class, (t_method)sickle_import, gensym("import"), A_DEFSYM, 0); class_addmethod(sickle_class, (t_method)sickle_click, |