aboutsummaryrefslogtreecommitdiff
path: root/cyclone/shadow
diff options
context:
space:
mode:
Diffstat (limited to 'cyclone/shadow')
-rw-r--r--cyclone/shadow/Makefile.objects1
-rw-r--r--cyclone/shadow/cyclone.c38
-rw-r--r--cyclone/shadow/dummies.c4
-rw-r--r--cyclone/shadow/maxmode.c84
4 files changed, 77 insertions, 50 deletions
diff --git a/cyclone/shadow/Makefile.objects b/cyclone/shadow/Makefile.objects
index 66aea0d..1ddea9c 100644
--- a/cyclone/shadow/Makefile.objects
+++ b/cyclone/shadow/Makefile.objects
@@ -1,6 +1,7 @@
SHARED_OBJECTS = \
common/loud.o \
common/grow.o \
+common/os.o \
common/fitter.o \
common/lex.o \
common/binport.o \
diff --git a/cyclone/shadow/cyclone.c b/cyclone/shadow/cyclone.c
index 30f1c84..cb051b6 100644
--- a/cyclone/shadow/cyclone.c
+++ b/cyclone/shadow/cyclone.c
@@ -19,8 +19,6 @@
typedef struct _cyclone
{
t_object x_ob;
- t_symbol *x_dir;
- t_symbol *x_canvasdir;
t_hammerfile *x_filehandle;
} t_cyclone;
@@ -32,39 +30,43 @@ static int cyclone_lastndx;
static void cyclone_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 cyclone_doimport(t_cyclone *x, t_symbol *fn, t_symbol *dir)
+static void cyclone_doimport(t_cyclone *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 cyclone_click(t_cyclone *x, t_floatarg xpos, t_floatarg ypos,
t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
{
- cyclone_doimport(x, 0, 0);
+ cyclone_doimport(x, 0);
}
static void cyclone_import(t_cyclone *x, t_symbol *fn)
{
- cyclone_doimport(x, fn, 0);
+ cyclone_doimport(x, fn);
}
static void cyclone_cd(t_cyclone *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 cyclone_pwd(t_cyclone *x)
+static void cyclone_pwd(t_cyclone *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 cyclone_bang(t_cyclone *x)
@@ -89,9 +91,7 @@ static void *cyclone_new(void)
{
t_cyclone *x = (t_cyclone *)pd_new(cyclone_class);
x->x_filehandle = hammerfile_new((t_pd *)x, 0, cyclone_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);
}
@@ -114,7 +114,7 @@ void cyclone_setup(void)
class_addmethod(cyclone_class, (t_method)cyclone_cd,
gensym("cd"), A_DEFSYM, 0);
class_addmethod(cyclone_class, (t_method)cyclone_pwd,
- gensym("pwd"), 0);
+ gensym("pwd"), A_SYMBOL, 0);
class_addmethod(cyclone_class, (t_method)cyclone_import,
gensym("import"), A_DEFSYM, 0);
class_addmethod(cyclone_class, (t_method)cyclone_click,
diff --git a/cyclone/shadow/dummies.c b/cyclone/shadow/dummies.c
index 5ad7cc1..f55c683 100644
--- a/cyclone/shadow/dummies.c
+++ b/cyclone/shadow/dummies.c
@@ -148,6 +148,7 @@ static void *dummy_if_new(t_symbol *s, int ac, t_atom *av)
return (x);
}
+#if 0
static void *dummy_matrix_tilde_new(t_symbol *s, int ac, t_atom *av)
{
t_dummy_slot *sl;
@@ -168,6 +169,7 @@ static void *dummy_matrix_tilde_new(t_symbol *s, int ac, t_atom *av)
dummy_io(x, nins, nouts + 1); /* CHECKME */
return (x);
}
+#endif
static void *dummy_rewire_tilde_new(t_symbol *s, int ac, t_atom *av)
{
@@ -406,7 +408,9 @@ static t_dummy_slot dummy_slots[] =
{ "lcd", 1, 4, 0, 0 }, /* CHECKME nouts */
{ "led", 1, 1, 0, 0 },
{ "matrixctrl", 1, 1, 0, 0 }, /* CHECKME nins, nouts */
+#if 0
{ "matrix~", -1, -1, 0, (t_newmethod)dummy_matrix_tilde_new },
+#endif
{ "menubar", 1, 4, 0, 0 }, /* LATER parse #Xs (additional outs) */
{ "meter~", 1, 1, 0, 0 }, /* LATER consider mapping to the vu */
{ "movie", 1, 3, 0, 0 },
diff --git a/cyclone/shadow/maxmode.c b/cyclone/shadow/maxmode.c
index 9cd1055..189c83e 100644
--- a/cyclone/shadow/maxmode.c
+++ b/cyclone/shadow/maxmode.c
@@ -16,9 +16,8 @@
typedef struct _maxmode
{
t_object x_ob;
- t_symbol *x_dir;
- t_symbol *x_canvasdir;
t_hammerfile *x_filehandle;
+ t_outlet *x_modeout;
} t_maxmode;
static t_class *maxmode_class;
@@ -29,39 +28,59 @@ static int maxmode_withbanner = 0;
static void maxmode_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 maxmode_doimport(t_maxmode *x, t_symbol *fn, t_symbol *dir)
+static void maxmode_doimport(t_maxmode *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 maxmode_click(t_maxmode *x, t_floatarg xpos, t_floatarg ypos,
t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
{
- maxmode_doimport(x, 0, 0);
+ maxmode_doimport(x, 0);
}
static void maxmode_import(t_maxmode *x, t_symbol *fn)
{
- maxmode_doimport(x, fn, 0);
+ maxmode_doimport(x, fn);
}
static void maxmode_cd(t_maxmode *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 maxmode_pwd(t_maxmode *x)
+static void maxmode_pwd(t_maxmode *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 maxmode_set(t_maxmode *x, t_symbol *s)
+{
+ if (!s || s == &s_)
+ s = gensym("none");
+ if (s != fitter_getmode())
+ fitter_setmode(s);
+}
+
+static void maxmode_get(t_maxmode *x)
+{
+ t_symbol *mode;
+ if (mode = fitter_getmode())
+ outlet_symbol(x->x_modeout, mode);
}
static void maxmode_bang(t_maxmode *x)
@@ -79,12 +98,14 @@ static void maxmode_bang(t_maxmode *x)
static void maxmode_free(t_maxmode *x)
{
+ /* FIXME cancel registration */
hammerfile_free(x->x_filehandle);
}
static void *maxmode_new(t_symbol *s, int ac, t_atom *av)
{
t_maxmode *x = (t_maxmode *)pd_new(maxmode_class);
+ int selective = ac;
if (maxmode_withbanner && !ac)
{
post("this is maxmode %s, %s %s build",
@@ -93,25 +114,22 @@ static void *maxmode_new(t_symbol *s, int ac, t_atom *av)
"creating maxmode object without loading cyclone components");
maxmode_withbanner = 0;
}
- if (!fittermax_get())
+ if (selective)
{
- int selective = 0;
- if (ac)
+ /* a numeric argument is valid -- transparent object is created
+ (global mode is not set, nothing is registered) */
+ while (ac--) if (av->a_type == A_SYMBOL)
{
- while (ac--) if (av->a_type == A_SYMBOL)
- {
- /* FIXME register into fitter for per-patch, selective
- compatibility control */
- av++;
- }
+ /* FIXME register into fitter for per-patch-file, selective
+ compatibility control */
+ av++;
}
- if (!selective)
- fittermax_set();
}
+ else if (!fittermax_get())
+ fittermax_set();
x->x_filehandle = hammerfile_new((t_pd *)x, 0, maxmode_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);
+ x->x_modeout = outlet_new((t_object *)x, &s_symbol);
return (x);
}
@@ -128,10 +146,14 @@ void maxmode_setup(void)
(t_method)maxmode_free,
sizeof(t_maxmode), 0, A_GIMME, 0);
class_addbang(maxmode_class, maxmode_bang);
+ class_addmethod(maxmode_class, (t_method)maxmode_set,
+ gensym("set"), A_DEFSYM, 0);
+ class_addmethod(maxmode_class, (t_method)maxmode_get,
+ gensym("get"), 0);
class_addmethod(maxmode_class, (t_method)maxmode_cd,
gensym("cd"), A_DEFSYM, 0);
class_addmethod(maxmode_class, (t_method)maxmode_pwd,
- gensym("pwd"), 0);
+ gensym("pwd"), A_SYMBOL, 0);
class_addmethod(maxmode_class, (t_method)maxmode_import,
gensym("import"), A_DEFSYM, 0);
class_addmethod(maxmode_class, (t_method)maxmode_click,
@@ -141,7 +163,7 @@ void maxmode_setup(void)
if (canvas_getcurrent())
{
- fitter_setup(0, 0, 0);
+ fitter_setup(0, 0);
if (!zgetfn(&pd_objectmaker, gensym("cyclone")))
/* cycloneless maxmode -- banner is posted by the oldest
maxmode object with no creation arguments */