aboutsummaryrefslogtreecommitdiff
path: root/externals/vanilla/openpanel.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-11-10 21:08:48 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-11-10 21:08:48 +0000
commit49180536552f487ca12e2173a93aae6a17ccfcca (patch)
tree93c9729987034227e1283c16380397bc1f957a49 /externals/vanilla/openpanel.c
parent33b135d7fc381a22965586e0567ede4da11eade3 (diff)
split out the objects in x_gui.c into standalone files and put the gfxstub stuff into e_gfxstub.c
svn path=/trunk/; revision=12749
Diffstat (limited to 'externals/vanilla/openpanel.c')
-rw-r--r--externals/vanilla/openpanel.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/externals/vanilla/openpanel.c b/externals/vanilla/openpanel.c
new file mode 100644
index 00000000..2efd8dfd
--- /dev/null
+++ b/externals/vanilla/openpanel.c
@@ -0,0 +1,62 @@
+/* Copyright (c) 1997-2000 Miller Puckette.
+* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+/* dialogs. LATER, deal with the situation where the object goes
+away before the panel does... */
+
+#include "m_pd.h"
+#include <stdio.h>
+#include <string.h>
+
+static t_class *openpanel_class;
+
+typedef struct _openpanel
+{
+ t_object x_obj;
+ t_symbol *x_s;
+} t_openpanel;
+
+static void *openpanel_new( void)
+{
+ char buf[50];
+ t_openpanel *x = (t_openpanel *)pd_new(openpanel_class);
+ sprintf(buf, "d%lx", (t_int)x);
+ x->x_s = gensym(buf);
+ pd_bind(&x->x_obj.ob_pd, x->x_s);
+ outlet_new(&x->x_obj, &s_symbol);
+ return (x);
+}
+
+static void openpanel_symbol(t_openpanel *x, t_symbol *s)
+{
+ char *path = (s && s->s_name) ? s->s_name : "\"\"";
+ sys_vgui("pdtk_openpanel {%s} {%s}\n", x->x_s->s_name, path);
+}
+
+static void openpanel_bang(t_openpanel *x)
+{
+ openpanel_symbol(x, &s_);
+}
+
+static void openpanel_callback(t_openpanel *x, t_symbol *s)
+{
+ outlet_symbol(x->x_obj.ob_outlet, s);
+}
+
+
+static void openpanel_free(t_openpanel *x)
+{
+ pd_unbind(&x->x_obj.ob_pd, x->x_s);
+}
+
+void openpanel_setup(void)
+{
+ openpanel_class = class_new(gensym("openpanel"),
+ (t_newmethod)openpanel_new, (t_method)openpanel_free,
+ sizeof(t_openpanel), 0, 0);
+ class_addbang(openpanel_class, openpanel_bang);
+ class_addsymbol(openpanel_class, openpanel_symbol);
+ class_addmethod(openpanel_class, (t_method)openpanel_callback,
+ gensym("callback"), A_SYMBOL, 0);
+}