aboutsummaryrefslogtreecommitdiff
path: root/shared/unstable
diff options
context:
space:
mode:
Diffstat (limited to 'shared/unstable')
-rw-r--r--shared/unstable/Makefile.sources3
-rw-r--r--shared/unstable/forky.c15
-rw-r--r--shared/unstable/forky.h2
-rw-r--r--shared/unstable/fragile.c2
-rw-r--r--shared/unstable/fringe.c98
-rw-r--r--shared/unstable/fringe.h10
6 files changed, 124 insertions, 6 deletions
diff --git a/shared/unstable/Makefile.sources b/shared/unstable/Makefile.sources
index 4636701..56f9969 100644
--- a/shared/unstable/Makefile.sources
+++ b/shared/unstable/Makefile.sources
@@ -1,4 +1,5 @@
OTHER_SOURCES = \
-fragile.c \
forky.c \
+fragile.c \
+fringe.c \
loader.c
diff --git a/shared/unstable/forky.c b/shared/unstable/forky.c
index 100f0af..2e17253 100644
--- a/shared/unstable/forky.c
+++ b/shared/unstable/forky.c
@@ -2,6 +2,8 @@
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+/* Put here compilation conditionals supporting older Pd versions. */
+
#include "m_pd.h"
#include "g_canvas.h"
#include "shared.h"
@@ -10,14 +12,19 @@
#if FORKY_VERSION < 37
/* need this for t_class::c_wb field access */
#include "unstable/pd_imp.h"
+#endif
-t_pd *pd_newest(void)
+//#define FORKY_DEBUG
+
+t_pd *forky_newobject(t_symbol *s, int ac, t_atom *av)
{
+#if FORKY_VERSION >= 37
+ typedmess(&pd_objectmaker, s, ac, av);
+ return (pd_newest());
+#else
return (0);
-}
#endif
-
-#define FORKY_DEBUG
+}
void forky_setsavefn(t_class *c, t_forkysavefn fn)
{
diff --git a/shared/unstable/forky.h b/shared/unstable/forky.h
index a32f8d6..bf59783 100644
--- a/shared/unstable/forky.h
+++ b/shared/unstable/forky.h
@@ -17,12 +17,12 @@
#define FORKY_WIDGETPADDING
#else
#define FORKY_WIDGETPADDING 0,0
-t_pd *pd_newest(void);
#endif
typedef void (*t_forkysavefn)(t_gobj *x, t_binbuf *bb);
typedef void (*t_forkypropertiesfn)(t_gobj *x, t_glist *gl);
+t_pd *forky_newobject(t_symbol *s, int ac, t_atom *av);
void forky_setsavefn(t_class *c, t_forkysavefn fn);
void forky_setpropertiesfn(t_class *c, t_forkypropertiesfn fn);
int forky_hasfeeders(t_object *x, t_glist *glist, int inno, t_symbol *outsym);
diff --git a/shared/unstable/fragile.c b/shared/unstable/fragile.c
index a5c9584..2c9e8e3 100644
--- a/shared/unstable/fragile.c
+++ b/shared/unstable/fragile.c
@@ -2,6 +2,8 @@
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+/* Put here bits and pieces likely to break with any new Pd version. */
+
#include <string.h>
#include "m_pd.h"
#include "unstable/pd_imp.h"
diff --git a/shared/unstable/fringe.c b/shared/unstable/fringe.c
new file mode 100644
index 0000000..cf29ec6
--- /dev/null
+++ b/shared/unstable/fringe.c
@@ -0,0 +1,98 @@
+/* Copyright (c) 1997-2003 Miller Puckette, krzYszcz, and others.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+/* Put here calls which are likely to (and should) make into Pd API some day. */
+
+#include "m_pd.h"
+#include "g_canvas.h"
+#include "unstable/forky.h"
+#include "unstable/fringe.h"
+
+static int gobj_getindex(t_glist *gl, t_gobj *ob)
+{
+ t_gobj *ob1;
+ int ndx;
+ for (ob1 = gl->gl_list, ndx = 0; ob1 && ob1 != ob; ob1 = ob1->g_next)
+ ndx++;
+ return (ndx);
+}
+
+static void gobj_totail(t_glist *gl, t_gobj *ob)
+{
+ if (ob->g_next)
+ {
+ t_gobj *ob1;
+ if (ob == gl->gl_list) ob1 = gl->gl_list = ob->g_next;
+ else
+ {
+ for (ob1 = gl->gl_list; ob1; ob1 = ob1->g_next)
+ if (ob1->g_next == ob)
+ break;
+ if (!ob1)
+ {
+ bug("gobj_totail");
+ return;
+ }
+ ob1->g_next = ob->g_next;
+ ob1 = ob1->g_next;
+ }
+ while (ob1->g_next) ob1 = ob1->g_next;
+ ob1->g_next = ob;
+ ob->g_next = 0;
+ }
+}
+
+static void gobj_stowconnections(t_glist *gl, t_gobj *ob, t_binbuf *bb)
+{
+ t_linetraverser lt;
+ t_outconnect *oc;
+ binbuf_clear(bb);
+ linetraverser_start(&lt, gl);
+ while (oc = linetraverser_next(&lt))
+ {
+ if ((t_gobj *)lt.tr_ob == ob || (t_gobj *)lt.tr_ob2 == ob)
+ binbuf_addv(bb, "ssiiii;",
+ gensym("#X"), gensym("connect"),
+ gobj_getindex(gl, (t_gobj *)lt.tr_ob), lt.tr_outno,
+ gobj_getindex(gl, (t_gobj *)lt.tr_ob2), lt.tr_inno);
+ }
+#if 0
+ post("packed connections:");
+ binbuf_print(bb);
+#endif
+}
+
+static void gobj_restoreconnections(t_glist *gl, t_binbuf *bb)
+{
+ pd_bind((t_pd *)gl, gensym("#X"));
+ binbuf_eval(bb, 0, 0, 0);
+ pd_unbind((t_pd *)gl, gensym("#X"));
+}
+
+void gobj_recreate(t_glist *gl, t_gobj *ob, t_binbuf *bb)
+{
+ /* LATER revisit all gobj calls, and sort out the gop case */
+ t_text *newt;
+ int xpix = ((t_text *)ob)->te_xpix, ypix = ((t_text *)ob)->te_ypix;
+ t_binbuf *bb1 = binbuf_new();
+ int ac = binbuf_getnatom(bb);
+ t_atom *av = binbuf_getvec(bb);
+ canvas_setcurrent(gl);
+ gobj_totail(gl, ob);
+ gobj_stowconnections(gl, ob, bb1);
+ glist_delete(gl, ob);
+ if (newt = (t_text *)forky_newobject(av->a_w.w_symbol, ac - 1, av + 1))
+ {
+ newt->te_binbuf = bb;
+ newt->te_xpix = xpix;
+ newt->te_ypix = ypix;
+ newt->te_width = 0;
+ newt->te_type = T_OBJECT;
+ glist_add(gl, (t_gobj *)newt);
+ gobj_restoreconnections(gl, bb1);
+ }
+ else bug("gobj_recreate");
+ binbuf_free(bb1);
+ canvas_unsetcurrent(gl);
+}
diff --git a/shared/unstable/fringe.h b/shared/unstable/fringe.h
new file mode 100644
index 0000000..0768183
--- /dev/null
+++ b/shared/unstable/fringe.h
@@ -0,0 +1,10 @@
+/* Copyright (c) 1997-2003 Miller Puckette, krzYszcz, and others.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+#ifndef __FRINGE_H__
+#define __FRINGE_H__
+
+void gobj_recreate(t_glist *gl, t_gobj *ob, t_binbuf *bb);
+
+#endif