From 9875a79860138b00864070a07839fd3b26ac337e Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Thu, 28 Jan 2016 01:02:00 -0500
Subject: [PATCH] port from pd-l2ork git:
 6084c8e5f86d1521edde3a899a6d5b5821aa27c6 (selective port-- didn't include the
 logic related to the x_selected member *fixed bug reported by Gilberto in
 http://disis.music.vt.edu/pipermail/l2ork-dev/2015-January/000676.html

---
 pd/src/g_array.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/pd/src/g_array.c b/pd/src/g_array.c
index cb3b374e8..ae7fd8305 100644
--- a/pd/src/g_array.c
+++ b/pd/src/g_array.c
@@ -767,7 +767,7 @@ void garray_arraydialog(t_garray *x, t_symbol *s, int argc, t_atom *argv)
 static void garray_free(t_garray *x)
 {
     t_pd *x2;
-        sys_unqueuegui(&x->x_gobj);
+    sys_unqueuegui(&x->x_gobj);
     gfxstub_deleteforkey(x);
     pd_unbind(&x->x_gobj.g_pd, x->x_realname);
         /* LATER find a way to get #A unbound earlier (at end of load?) */
@@ -1518,16 +1518,22 @@ void garray_redraw(t_garray *x)
 {
     //fprintf(stderr,"garray_redraw\n");
     if (glist_isvisible(x->x_glist))
-        // enqueueing redraw ensures that the array is drawn after its values
-        // have been instantiated (instead, we address this in the creating
-        // dialog by enqueuing redrawing of the graph garray resides in as
-        // this will fix the lack of the array name and other features
-        // hence this approach is considered wrong
-        //sys_queuegui(&x->x_gobj, x->x_glist, garray_doredraw);
-
-        // this is useful so that things get redrawn before they are selected
-        // so that we don't have to fake yet another selection after the fact
-        garray_doredraw(&x->x_gobj, x->x_glist);
+        /* enqueueing redraw ensures that the array is drawn after its values
+           have been instantiated
+           1-24-2015 Ico: reenabled this method to optimize redrawing as per
+           Gilberto's report on l2ork-dev list.
+           TODO: when adding new array to the newest array it is not always
+           drawn, or tabwrite does not write to the right array--see Gilberto's
+           example available from:
+           http://disis.music.vt.edu/pipermail/l2ork-dev/2015-January/000676.htm
+        */
+        sys_queuegui(&x->x_gobj, x->x_glist, garray_doredraw);
+
+        /* 1-24-2015 Ico: this however causes painfully slow and inefficient red
+           when we use tabwrite which writes one point per array and requests
+           redraw after each point is changed. Thus it is deprecated in favor of
+           of the approach above */
+        //garray_doredraw(&x->x_gobj, x->x_glist);
 }
 
    /* This function gets the template of an array; if we can't figure
-- 
GitLab