aboutsummaryrefslogtreecommitdiff
path: root/cyclone/hammer/hammer.c
diff options
context:
space:
mode:
authorN.N. <krzyszcz@users.sourceforge.net>2005-01-27 14:42:55 +0000
committerN.N. <krzyszcz@users.sourceforge.net>2005-01-27 14:42:55 +0000
commitbfb359fd22e61faaca3a6e49ad3b7a81f2d71551 (patch)
treed070071515c7e7f53073da32046b24855e8307c8 /cyclone/hammer/hammer.c
parent6435314717c5fb8fa062eb682c72c8df095b1be3 (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/hammer/hammer.c')
-rw-r--r--cyclone/hammer/hammer.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/cyclone/hammer/hammer.c b/cyclone/hammer/hammer.c
index a728ec7..7e0d6e4 100644
--- a/cyclone/hammer/hammer.c
+++ b/cyclone/hammer/hammer.c
@@ -13,8 +13,6 @@ void allhammers_setup(void);
typedef struct _hammer
{
t_object x_ob;
- t_symbol *x_dir;
- t_symbol *x_canvasdir;
t_hammerfile *x_filehandle;
} t_hammer;
@@ -24,39 +22,43 @@ static int hammer_lastndx;
static void hammer_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 hammer_doimport(t_hammer *x, t_symbol *fn, t_symbol *dir)
+static void hammer_doimport(t_hammer *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 hammer_click(t_hammer *x, t_floatarg xpos, t_floatarg ypos,
t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
{
- hammer_doimport(x, 0, 0);
+ hammer_doimport(x, 0);
}
static void hammer_import(t_hammer *x, t_symbol *fn)
{
- hammer_doimport(x, fn, 0);
+ hammer_doimport(x, fn);
}
static void hammer_cd(t_hammer *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 hammer_pwd(t_hammer *x)
+static void hammer_pwd(t_hammer *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 hammer_bang(t_hammer *x)
@@ -74,9 +76,7 @@ static void *hammer_new(void)
{
t_hammer *x = (t_hammer *)pd_new(hammer_class);
x->x_filehandle = hammerfile_new((t_pd *)x, 0, hammer_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 hammer_setup(void)
class_addmethod(hammer_class, (t_method)hammer_cd,
gensym("cd"), A_DEFSYM, 0);
class_addmethod(hammer_class, (t_method)hammer_pwd,
- gensym("pwd"), 0);
+ gensym("pwd"), A_SYMBOL, 0);
class_addmethod(hammer_class, (t_method)hammer_import,
gensym("import"), A_DEFSYM, 0);
class_addmethod(hammer_class, (t_method)hammer_click,