From dbba1169cd8860be4fe0346c6b94e31f11c5bf95 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Tue, 15 Mar 2011 20:15:00 -0400
Subject: [PATCH] Pd-0.42.5-extended-l2ork-dev-20110315.tar.bz2

---
 src/g_canvas.c            |  7 ++++++-
 src/g_graph.c             | 20 +++++++++++++++-----
 src/m_binbuf.c            |  3 +++
 src/m_pd.h                |  2 +-
 src/makefile.dependencies |  2 +-
 5 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/src/g_canvas.c b/src/g_canvas.c
index 6ed6165cb..ba61b759c 100644
--- a/src/g_canvas.c
+++ b/src/g_canvas.c
@@ -434,6 +434,7 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
     if (strcmp(x->gl_name->s_name, "Pd"))
         pd_bind(&x->gl_pd, canvas_makebindsym(x->gl_name));
     x->gl_loading = 1;
+	//fprintf(stderr,"loading = 1 .x%lx owner=.x%lx\n", x, x->gl_owner);
     x->gl_goprect = 0;      /* no GOP rectangle unless it's turned on later */
         /* cancel "vis" flag if we're a subpatch of an
          abstraction inside another patch.  A separate mechanism prevents
@@ -915,6 +916,7 @@ static void canvas_pop(t_canvas *x, t_floatarg fvis)
     canvas_resortinlets(x);
     canvas_resortoutlets(x);
     x->gl_loading = 0;
+	//fprintf(stderr,"loading = 0 .x%lx owner=.x%lx\n", x, x->gl_owner);
 }
 
 void canvas_objfor(t_glist *gl, t_text *x, int argc, t_atom *argv);
@@ -1073,9 +1075,12 @@ void canvas_popabstraction(t_canvas *x)
 {
     newest = &x->gl_pd;
     pd_popsym(&x->gl_pd);
-    x->gl_loading = 0;
+    //x->gl_loading = 1;
+	//fprintf(stderr,"loading = 1 .x%lx owner=.x%lx\n", x, x->gl_owner);
     canvas_resortinlets(x);
     canvas_resortoutlets(x);
+    x->gl_loading = 0;
+	//fprintf(stderr,"loading = 0 .x%lx owner=.x%lx\n", x, x->gl_owner);
 }
 
 void canvas_logerror(t_object *y)
diff --git a/src/g_graph.c b/src/g_graph.c
index af2885480..4279cfa94 100644
--- a/src/g_graph.c
+++ b/src/g_graph.c
@@ -8,6 +8,7 @@ to this file... */
 
 #include <stdlib.h>
 #include "m_pd.h"
+#include "m_imp.h"
 #include "t_tk.h"
 #include "g_canvas.h"
 #include "s_stuff.h"    /* for sys_hostfontsize */
@@ -372,12 +373,20 @@ void canvas_resortinlets(t_canvas *x)
         obj_moveinletfirst(&x->gl_obj, ip);
     }
     freebytes(vec, ninlets * sizeof(*vec));
-    if (x->gl_owner && glist_isvisible(x->gl_owner)) {
+    if (x->gl_owner && glist_isvisible(x->gl_owner) && glist_isvisible(x) && !x->gl_owner->gl_loading && !x->gl_loading) {
         canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
-		//fprintf(stderr,"good place to fix redrawing of inlets\n");
-		//fprintf(stderr,"found it\n");
+		//fprintf(stderr,"good place to fix redrawing of inlets .x%lx owner=.x%lx %d (parent)%d\n", x, x->gl_owner, x->gl_loading, x->gl_owner->gl_loading);
+/*		t_object *ob = pd_checkobject(&y->g_pd);
+		t_rtext *rt = glist_findrtext(x->gl_owner, (t_text *)&ob->ob_g);
+		for (i = 0; i < ninlets; i++) {
+            sys_vgui(".x%x.c itemconfigure %si%d -fill %s -width 1\n",
+                     x, rtext_gettag(rt), i, 
+                     (obj_issignalinlet(ob, i) ? "$signal_nlet" : "$msg_nlet"));
+		}
+*/
+		//glist_redraw(x);
 	    graph_vis(&x->gl_gobj, x->gl_owner, 0); 
-	    graph_vis(&x->gl_gobj, x->gl_owner, 1);
+		graph_vis(&x->gl_gobj, x->gl_owner, 1);
 	}
 }
 
@@ -450,10 +459,11 @@ void canvas_resortoutlets(t_canvas *x)
         obj_moveoutletfirst(&x->gl_obj, ip);
     }
     freebytes(vec, noutlets * sizeof(*vec));
-    if (x->gl_owner && glist_isvisible(x->gl_owner)) {
+    if (x->gl_owner && glist_isvisible(x->gl_owner) && glist_isvisible(x) && !x->gl_owner->gl_loading && !x->gl_loading) {
         canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
 		//fprintf(stderr,"good place to fix redrawing of outlets\n");
 		//fprintf(stderr,"found it\n");
+		//glist_redraw(x);
         graph_vis(&x->gl_gobj, x->gl_owner, 0); 
         graph_vis(&x->gl_gobj, x->gl_owner, 1);
 	}
diff --git a/src/m_binbuf.c b/src/m_binbuf.c
index 47fca2f8c..e0283fda8 100644
--- a/src/m_binbuf.c
+++ b/src/m_binbuf.c
@@ -608,9 +608,12 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv)
     t_atom *at = x->b_vec;
     int ac = x->b_n;
     int nargs, maxnargs = 0;
+
 	//first we need to check if the list of arguments has $@
+	//fprintf(stderr,"ac=%d\n", ac);
 	int count;
 	for (count = 0; count < ac; count++) {
+		//fprintf(stderr, "count %d\n", count);
 		if (at[count].a_type == A_DOLLAR && at[count].a_w.w_symbol==gensym("@")) {
 			//fprintf(stderr,"yes %d %d %d\n", ac, argc, ac+argc-1);
 			ac = ac + argc;
diff --git a/src/m_pd.h b/src/m_pd.h
index f1c4f95b0..7c8555a1d 100644
--- a/src/m_pd.h
+++ b/src/m_pd.h
@@ -11,7 +11,7 @@ extern "C" {
 #define PD_MAJOR_VERSION 0
 #define PD_MINOR_VERSION 42
 #define PD_BUGFIX_VERSION 5
-#define PD_TEST_VERSION "extended-l2ork-20110312"
+#define PD_TEST_VERSION "extended-l2ork-20110315"
 
 /* old name for "MSW" flag -- we have to take it for the sake of many old
 "nmakefiles" for externs, which will define NT and not MSW */
diff --git a/src/makefile.dependencies b/src/makefile.dependencies
index 9cad237e0..2f2d94308 100644
--- a/src/makefile.dependencies
+++ b/src/makefile.dependencies
@@ -118,7 +118,7 @@ g_graph.o: g_graph.c /usr/include/stdlib.h /usr/include/features.h \
  /usr/include/sys/select.h /usr/include/bits/select.h \
  /usr/include/bits/sigset.h /usr/include/bits/time.h \
  /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
- /usr/include/alloca.h m_pd.h t_tk.h g_canvas.h s_stuff.h \
+ /usr/include/alloca.h m_pd.h m_imp.h t_tk.h g_canvas.h s_stuff.h \
  /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
  /usr/include/wchar.h /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \
  /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
-- 
GitLab