aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2008-11-27 17:10:04 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2008-11-27 17:10:04 +0000
commitfe8a767914f1b6ec729e1fe77027c5f2ee2b0041 (patch)
treebf591db51373d26237fd203c8c393136d45ce93e
parent7b9194564bae89062cc9232d2f22a414d1eda436 (diff)
accept parent-depth as argument
svn path=/trunk/externals/iem/iemguts/; revision=10399
-rw-r--r--src/canvasargs.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/canvasargs.c b/src/canvasargs.c
index 019daaf..35c26ae 100644
--- a/src/canvasargs.c
+++ b/src/canvasargs.c
@@ -91,11 +91,19 @@ static void canvasargs_free(t_canvasargs *x)
{
}
-static void *canvasargs_new(void)
+static void *canvasargs_new(t_floatarg f)
{
t_canvasargs *x = (t_canvasargs *)pd_new(canvasargs_class);
t_glist *glist=(t_glist *)canvas_getcurrent();
t_canvas *canvas=(t_canvas*)glist_getcanvas(glist);
+
+ int depth=(int)f;
+ if(depth<0)depth=0;
+
+ while(depth && canvas) {
+ canvas=canvas->gl_owner;
+ depth--;
+ }
x->x_canvas = canvas;
@@ -106,7 +114,7 @@ static void *canvasargs_new(void)
void canvasargs_setup(void)
{
canvasargs_class = class_new(gensym("canvasargs"), (t_newmethod)canvasargs_new,
- (t_method)canvasargs_free, sizeof(t_canvasargs), 0, 0);
+ (t_method)canvasargs_free, sizeof(t_canvasargs), 0, A_DEFFLOAT, 0);
class_addlist(canvasargs_class, (t_method)canvasargs_list);
class_addbang(canvasargs_class, (t_method)canvasargs_bang);
}