From 755a8afc65e12ee209e51a948c19e72a32e7a6ec Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Sun, 16 Dec 2012 16:50:27 -0500
Subject: [PATCH] fixed problem where using find/finderror would open the new
 window (where offending object is located) but would not properly select the
 said object

---
 pd/src/g_bang.c     | 4 ++--
 pd/src/g_editor.c   | 4 ++--
 pd/src/g_graph.c    | 2 +-
 pd/src/g_hdial.c    | 4 ++--
 pd/src/g_hslider.c  | 4 ++--
 pd/src/g_mycanvas.c | 4 ++--
 pd/src/g_numbox.c   | 4 ++--
 pd/src/g_text.c     | 3 ++-
 pd/src/g_toggle.c   | 4 ++--
 pd/src/g_vdial.c    | 4 ++--
 pd/src/g_vslider.c  | 4 ++--
 pd/src/g_vumeter.c  | 4 ++--
 12 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c
index 6beba3070..22a1182ef 100644
--- a/pd/src/g_bang.c
+++ b/pd/src/g_bang.c
@@ -240,7 +240,7 @@ void bng_draw_select(t_bng* x, t_glist* glist)
 	t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
 	t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
 
-	if (glist_isvisible(canvas)) {
+	//if (glist_isvisible(canvas)) {
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
@@ -305,7 +305,7 @@ void bng_draw_select(t_bng* x, t_glist* glist)
 			sys_vgui("destroy %s\n", lh->h_pathname);
 			x->x_gui.label_vis = 0;
 		}
-	}
+	//}
 }
 
 static void bng__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_floatarg yyy)
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index b73cbc4c4..0b5499d35 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -3091,7 +3091,7 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit)
 				
 				if (pd_class(&y1->g_pd) == preset_node_class) {
 					if (pd_class(&y2->g_pd) == message_class) {
-						error("preset_node does not work with messages.\n");
+						error("preset_node does not work with messages.");
 						return;
 					}
 				}
@@ -4707,7 +4707,7 @@ void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno,
 		/* now check for illegal connections between preset_node object and other non-supported objects */
 	if (pd_class(&src->g_pd) == preset_node_class) {
 		if (pd_class(&sink->g_pd) == message_class) {
-				error("preset_node does not work with messages.\n");
+				error("preset_node does not work with messages.");
 				goto bad;
 		}
 	}
diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c
index c56bd8902..db1bb2c8a 100644
--- a/pd/src/g_graph.c
+++ b/pd/src/g_graph.c
@@ -1123,7 +1123,7 @@ static void graph_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy)
 
 static void graph_select(t_gobj *z, t_glist *glist, int state)
 {
-	//fprintf(stderr,"graph_select .x%lx %d...\n", (t_int)z, state);
+	//fprintf(stderr,"graph_select .x%lx .x%lx %d...\n", (t_int)z, (t_int)glist, state);
     t_glist *x = (t_glist *)z;
     if (!x->gl_isgraph)
         text_widgetbehavior.w_selectfn(z, glist, state);
diff --git a/pd/src/g_hdial.c b/pd/src/g_hdial.c
index 1d32a203e..2cac378d1 100644
--- a/pd/src/g_hdial.c
+++ b/pd/src/g_hdial.c
@@ -271,7 +271,7 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
 	t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
     int n=x->x_number, i;
 
-	if (glist_isvisible(canvas)) {
+	//if (glist_isvisible(canvas)) {
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
@@ -341,7 +341,7 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
 			sys_vgui("destroy %s\n", lh->h_pathname);
 			x->x_gui.label_vis = 0;
 		}
-	}
+	//}
 }
 
 static void hradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_floatarg yyy)
diff --git a/pd/src/g_hslider.c b/pd/src/g_hslider.c
index 2153439a4..b6f0fa514 100644
--- a/pd/src/g_hslider.c
+++ b/pd/src/g_hslider.c
@@ -260,7 +260,7 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist)
 	t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
 	t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
 
-	if (glist_isvisible(canvas)) {
+	//if (glist_isvisible(canvas)) {
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
@@ -323,7 +323,7 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist)
 			sys_vgui("destroy %s\n", lh->h_pathname);
 			x->x_gui.label_vis = 0;
 		}
-	}
+	//}
 }
 
 void hslider_check_minmax(t_hslider *x, double min, double max);
diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c
index 4f6a76c47..7057ed6dd 100644
--- a/pd/src/g_mycanvas.c
+++ b/pd/src/g_mycanvas.c
@@ -138,7 +138,7 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
 	t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
 	t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
 
-	if (glist_isvisible(canvas)) {
+	//if (glist_isvisible(canvas)) {
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
@@ -199,7 +199,7 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
 			sys_vgui("destroy %s\n", lh->h_pathname);
 			x->x_gui.label_vis = 0;
 		}
-	}
+	//}
 }
 
 static void my_canvas__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_floatarg yyy)
diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c
index d8efccc30..c677ea682 100644
--- a/pd/src/g_numbox.c
+++ b/pd/src/g_numbox.c
@@ -440,7 +440,7 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist)
 	t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
 	t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
 
-	if (glist_isvisible(canvas)) {
+	//if (glist_isvisible(canvas)) {
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
@@ -527,7 +527,7 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist)
 			sys_vgui("destroy %s\n", lh->h_pathname);
 			x->x_gui.label_vis = 0;
 		}
-	}
+	//}
 }
 
 static void my_numbox__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_floatarg yyy)
diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index c2451f02d..204ac3e7a 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -1311,7 +1311,8 @@ static void text_select(t_gobj *z, t_glist *glist, int state)
         outline = "$dash_outline";
     else
         outline = "$box_outline";
-    if (glist_isvisible(glist) && gobj_shouldvis(&x->te_g, glist)) {
+	//fprintf(stderr,"text_select isvisible=%d shouldvis=%d istoplevel=%d\n", glist_isvisible(glist), gobj_shouldvis(&x->te_g, glist), glist_istoplevel(glist));
+    if (gobj_shouldvis(&x->te_g, glist)) {
 		if (glist_istoplevel(glist)) {
 		    sys_vgui(".x%lx.c itemconfigure %sR -outline %s\n", glist_getcanvas(glist), 
 		             rtext_gettag(y), (state? "$select_color" : outline));
diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c
index 2641d9cae..4fe226ce4 100644
--- a/pd/src/g_toggle.c
+++ b/pd/src/g_toggle.c
@@ -258,7 +258,7 @@ void toggle_draw_select(t_toggle* x, t_glist* glist)
 	t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
 	t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
 
-	if (glist_isvisible(canvas)) {
+	//if (glist_isvisible(canvas)) {
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
@@ -322,7 +322,7 @@ void toggle_draw_select(t_toggle* x, t_glist* glist)
 			sys_vgui("destroy %s\n", lh->h_pathname);
 			x->x_gui.label_vis = 0;
 		}
-	}
+	//}
 }
 
 static void toggle__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_floatarg yyy)
diff --git a/pd/src/g_vdial.c b/pd/src/g_vdial.c
index c996c87c8..18e1b0bfa 100644
--- a/pd/src/g_vdial.c
+++ b/pd/src/g_vdial.c
@@ -270,7 +270,7 @@ void vradio_draw_select(t_vradio* x, t_glist* glist)
 	t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
     int n=x->x_number, i;
 
-	if (glist_isvisible(canvas)) {
+	//if (glist_isvisible(canvas)) {
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
@@ -342,7 +342,7 @@ void vradio_draw_select(t_vradio* x, t_glist* glist)
 			sys_vgui("destroy %s\n", lh->h_pathname);
 			x->x_gui.scale_vis = 0;
 		}
-	}
+	//}
 }
 
 static void vradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_floatarg yyy)
diff --git a/pd/src/g_vslider.c b/pd/src/g_vslider.c
index 0c499b6e6..b98aedc25 100644
--- a/pd/src/g_vslider.c
+++ b/pd/src/g_vslider.c
@@ -268,7 +268,7 @@ static void vslider_draw_select(t_vslider *x, t_glist *glist)
 	t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
 	t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
 
-	if (glist_isvisible(canvas)) {
+	//if (glist_isvisible(canvas)) {
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
@@ -331,7 +331,7 @@ static void vslider_draw_select(t_vslider *x, t_glist *glist)
 			sys_vgui("destroy %s\n", lh->h_pathname);
 			x->x_gui.label_vis = 0;
 		}
-	}
+	//}
 }
 
 void vslider_check_minmax(t_vslider *x, double min, double max);
diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c
index 945580c90..f2910093c 100644
--- a/pd/src/g_vumeter.c
+++ b/pd/src/g_vumeter.c
@@ -452,7 +452,7 @@ static void vu_draw_select(t_vu* x,t_glist* glist)
 	t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
 	t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
 
-	if (glist_isvisible(canvas)) {
+	//if (glist_isvisible(canvas)) {
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
@@ -538,7 +538,7 @@ static void vu_draw_select(t_vu* x,t_glist* glist)
 			sys_vgui("destroy %s\n", lh->h_pathname);
 			x->x_gui.label_vis = 0;
 		}
-	}
+	//}
 }
 
 static void vu__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_floatarg yyy)
-- 
GitLab