aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2013-12-17 16:04:14 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2013-12-17 16:04:14 +0000
commit909c3342031f0ad73d0aadba4ee03b1eabad2734 (patch)
tree07e230abd4390de1fd3dfe6a70ed51b1bc9f1488
parent5555ad49577fa1e3157081f8a61364bead0f5f5b (diff)
get/set displayname
svn path=/trunk/externals/iem/iemguts/; revision=17232
-rw-r--r--src/canvasname.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/canvasname.c b/src/canvasname.c
index 9a469aa..fa852ce 100644
--- a/src/canvasname.c
+++ b/src/canvasname.c
@@ -45,6 +45,8 @@ typedef struct _canvasname
t_object x_obj;
t_canvas *x_canvas;
+ t_outlet*x_nameout;
+ t_outlet*x_glnameout;
} t_canvasname;
@@ -54,17 +56,24 @@ static void canvasname_bang(t_canvasname *x)
t_binbuf*b=0;
t_atom name[1];
- if(!x->x_canvas) return;
- b=x->x_canvas->gl_obj.te_binbuf;
+ if(!c) return;
+
+ if(c->gl_name)
+ outlet_symbol(x->x_glnameout, c->gl_name);
+
+
+ b=c->gl_obj.te_binbuf;
+
if(b) {
/* get the binbufs atomlist */
t_atom*ap=binbuf_getvec(b);
t_symbol*s=atom_getsymbol(ap);
- outlet_symbol(x->x_obj.ob_outlet, s);
-
- return;
+ if(s)
+ outlet_symbol(x->x_nameout, s);
} else {
- //post("empty binbuf for %x", x->x_canvas);
+#if 0
+ post("empty binbuf for %x", x->x_canvas);
+#endif
}
}
@@ -73,7 +82,6 @@ static void canvasname_symbol(t_canvasname *x, t_symbol*s)
t_canvas*c=x->x_canvas;
t_binbuf*b=0;
t_atom name[1];
-
if(!x->x_canvas) return;
b=x->x_canvas->gl_obj.te_binbuf;
@@ -85,9 +93,17 @@ static void canvasname_symbol(t_canvasname *x, t_symbol*s)
return;
}
}
+static void canvasname_glname(t_canvasname *x, t_symbol*s)
+{
+ t_canvas*c=x->x_canvas;
+ if(!c) return;
+ c->gl_name = s;
+}
static void canvasname_free(t_canvasname *x)
{
+ if(x->x_nameout )outlet_free(x->x_nameout );x->x_nameout=NULL ;
+ if(x->x_glnameout)outlet_free(x->x_glnameout);x->x_glnameout=NULL;
}
static void *canvasname_new(t_floatarg f)
@@ -95,7 +111,6 @@ static void *canvasname_new(t_floatarg f)
t_canvasname *x = (t_canvasname *)pd_new(canvasname_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;
@@ -106,7 +121,8 @@ static void *canvasname_new(t_floatarg f)
x->x_canvas = canvas;
- outlet_new(&x->x_obj, &s_symbol);
+ x->x_nameout=outlet_new(&x->x_obj, &s_symbol);
+ x->x_glnameout=outlet_new(&x->x_obj, &s_symbol);
return (x);
}
@@ -116,5 +132,6 @@ void canvasname_setup(void)
canvasname_class = class_new(gensym("canvasname"), (t_newmethod)canvasname_new,
(t_method)canvasname_free, sizeof(t_canvasname), 0, A_DEFFLOAT, 0);
class_addsymbol(canvasname_class, (t_method)canvasname_symbol);
+ class_addmethod(canvasname_class, (t_method)canvasname_glname, gensym("display"), A_SYMBOL, 0);
class_addbang (canvasname_class, (t_method)canvasname_bang);
}