From b9c87faac2380ccc4372c293dfc04ecd0c600823 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Mon, 9 Dec 2013 18:33:01 -0500
Subject: [PATCH] *forced array graphs to keep GOP/hidetext under all
 circumstances (later update properties window so that the GUI reflects this
 rather than printing info in the console)

---
 pd/src/g_canvas.c |  6 +++++-
 pd/src/g_editor.c | 29 +++++++++++++++++++----------
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index 1b2ca8b6f..5223d5ba4 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -593,14 +593,18 @@ void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv)
 int glist_isgraph(t_glist *x)
 {
     // testing to see if we have an array and force hiding text (later update GUI accordingly)
+    // we likely need this to silently update legacy arrays
+    // (no regressions are expected but this needs to be tested)
     t_gobj *g = x->gl_list;
     int hasarray = 0;
     while (g) {
         if (pd_class(&g->g_pd) == garray_class) hasarray = 1;
         g = g->g_next;
     }
-    if (hasarray && x->gl_isgraph && !x->gl_hidetext)
+    if (hasarray)  {
+        x->gl_isgraph = 1;
         x->gl_hidetext = 1;
+    }
     return (x->gl_isgraph|(x->gl_hidetext<<1));
 }
 
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 725fd9f48..88911058b 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -2370,18 +2370,15 @@ void canvas_setgraph(t_glist *x, int flag, int nogoprect)
 		}
         x->gl_isgraph = 1;
         x->gl_hidetext = !(!(flag&2));
-        
 
         // check if we have array inside GOP, if so, make sure hidetext is always hidden no matter what
-        t_gobj *g = x->gl_list;
-        int hasarray = 0;
-        while (g) {
-        	if (pd_class(&g->g_pd) == garray_class) hasarray = 1;
-        	g = g->g_next;
-        }
-        if (hasarray)
-        	x->gl_hidetext = 1;
-
+	    t_gobj *g = x->gl_list;
+	    int hasarray = 0;
+	    while (g) {
+	    	if (pd_class(&g->g_pd) == garray_class) hasarray = 1;
+	    	g = g->g_next;
+	    }
+	    if (hasarray) x->gl_hidetext = 1;
 
         if (!nogoprect && !x->gl_goprect)
         {
@@ -2476,6 +2473,18 @@ static void canvas_donecanvasdialog(t_glist *x,
     if (yperpix == 0)
         yperpix = 1;
 
+    // check if we have array inside GOP, if so, make sure GOP/hidetext is always enabled no matter what
+    t_gobj *g = x->gl_list;
+    int hasarray = 0;
+    while (g) {
+    	if (pd_class(&g->g_pd) == garray_class) hasarray = 1;
+    	g = g->g_next;
+    }
+    if (hasarray && graphme != 3) {
+    	graphme = 3; //gop flag + bit-shifted hidetext
+    	post("Array graphs cannot have their 'graph on parent' or 'hide object name and arguments' options disabled");
+    }
+    
     if (graphme)
     {
         if (x1 != x2)
-- 
GitLab