From 2d999592f303cbe19b4aaff168a4ad28026b169d Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jancsika@yahoo.com>
Date: Mon, 14 Jul 2014 21:42:21 -0400
Subject: [PATCH] make ds array elements show up properly, plus some stray
 formatting improvements

---
 pd/src/g_editor.c   |  2 +-
 pd/src/g_graph.c    |  2 +-
 pd/src/g_scalar.c   |  1 -
 pd/src/g_template.c | 12 +++++++-----
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 0d40081f7..ff664ddf6 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -5184,7 +5184,7 @@ extern void graph_checkgop_rect(t_gobj *z, t_glist *glist,
 
 void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
     t_floatarg fmod)
-{ 
+{
     //fprintf(stderr,"motion %d %d %d %d\n",
     //    (int)xpos, (int)ypos, (int)fmod, canvas_last_glist_mod);
     //fprintf(stderr,"canvas_motion=%d\n",x->gl_editor->e_onmotion);
diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c
index 05eccc20f..1f1d2b0e8 100644
--- a/pd/src/g_graph.c
+++ b/pd/src/g_graph.c
@@ -803,7 +803,7 @@ int text_ypix(t_text *x, t_glist *glist)
     This is too conservative -- for instance, when you draw an "open"
     rectangle on the parent, you shouldn't have to redraw the window!  */
 void glist_redraw(t_glist *x)
-{  
+{
     if (glist_isvisible(x))
     {
             /* LATER fix the graph_vis() code to handle both cases */
diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index 444e7b602..f962034ba 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -833,7 +833,6 @@ int scalar_groupclick(struct _glist *groupcanvas,
         if (pd_class(&y->g_pd) == canvas_class &&
             ((t_glist *)y)->gl_svg)
         {
-//            fprintf(stderr, "fuck dolphins");
             if (hit = scalar_groupclick((t_glist *)y, data, template, sc, ap,
                 owner, xloc, yloc, xpix, ypix,
                 shift, alt, dbl, doit, basex, basey))
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index ebd3ac826..ffc853ed5 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -5121,14 +5121,16 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist,
                     fielddesc_cvttocoord(yfielddesc, yval);
                 for (y = elemtemplatecanvas->gl_list; y; y = y->g_next)
                 {
+                    /* We're setting up a special group that will get set as
+                       the parent by array elements */
+                    sys_vgui(".x%lx.c create group -tags {.scelem%lx.%lx} "
+                             "-parent {.dgroup%lx.%lx}\n",
+                        glist_getcanvas(glist), elemtemplatecanvas,
+                        (t_word *)(elem + elemsize * i),
+                        x->x_canvas, data);
                     if (pd_class(&y->g_pd) == canvas_class &&
                         ((t_glist *)y)->gl_svg)
                     {
-                        sys_vgui(".x%lx.c create group -tags {.scelem%lx.%lx} "
-                                 "-parent {.dgroup%lx.%lx}\n",
-                            glist_getcanvas(glist), elemtemplatecanvas,
-                            (t_word *)(elem + elemsize * i),
-                            x->x_canvas, data);
                         plot_groupvis(sc, glist,
                             (t_word *)(elem + elemsize * i),
                         template, (t_glist *)y, 
-- 
GitLab