From 9fdee4f36f1f74564e20cfd1f5c27c0e3c22da1d Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@monsoon-hp.(none)>
Date: Sat, 21 Jan 2012 12:01:30 -0500
Subject: [PATCH] Added support for moving GOP objects via tag and disabled
 showing of resize handles on iemgui objects when displayed inside a gop
 window (this became an issue due to new way of selecting gop objects which
 now also includes all objects inside it).

---
 src/g_bang.c     | 73 ++++++++++++++++++++++++++----------------------
 src/g_graph.c    | 28 ++++++++++++++++++-
 src/g_hdial.c    | 71 ++++++++++++++++++++++++----------------------
 src/g_hslider.c  | 73 ++++++++++++++++++++++++++----------------------
 src/g_mycanvas.c | 73 ++++++++++++++++++++++++++----------------------
 src/g_numbox.c   | 71 ++++++++++++++++++++++++----------------------
 src/g_text.c     | 16 +++++++++--
 src/g_toggle.c   | 73 ++++++++++++++++++++++++++----------------------
 src/g_vdial.c    | 73 ++++++++++++++++++++++++++----------------------
 src/g_vslider.c  | 73 ++++++++++++++++++++++++++----------------------
 src/g_vumeter.c  | 71 ++++++++++++++++++++++++----------------------
 src/pd.tk        | 18 ++++++++++++
 12 files changed, 407 insertions(+), 306 deletions(-)

diff --git a/src/g_bang.c b/src/g_bang.c
index f2fe28be2..3ef86a8b5 100644
--- a/src/g_bang.c
+++ b/src/g_bang.c
@@ -248,43 +248,48 @@ void bng_draw_select(t_bng* x, t_glist* glist)
 		    sys_vgui(".x%lx.c itemconfigure %lxBUT -outline $select_color\n", canvas, x);
 		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
 
-			if (x->x_gui.scale_vis)
-				sys_vgui("destroy %s\n", sh->h_pathname);
-
-			sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
-				 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
-			sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxBNG}\n",
-				 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
-				 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
-				 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
-				 sh->h_pathname, x, x);
-			sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			x->x_gui.scale_vis = 1;
-
-			if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
-			{
-				if (x->x_gui.label_vis)
-					sys_vgui("destroy %s\n", lh->h_pathname);
-
-				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
-					lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
-				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxBNG}\n",
-					canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
-					x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
-					LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
-					lh->h_pathname, x, x);
+			// check if we are drawing inside a gop abstraction visible on parent canvas
+			// if so, disable drawing of the handles
+			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
+
+				if (x->x_gui.scale_vis)
+					sys_vgui("destroy %s\n", sh->h_pathname);
+
+				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
+					 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
+				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxBNG}\n",
+					 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
+					 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
+					 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
+					 sh->h_pathname, x, x);
 				sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name); 
-				x->x_gui.label_vis = 1;
+					 sh->h_pathname, sh->h_bindsym->s_name);
+				x->x_gui.scale_vis = 1;
+
+				if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
+				{
+					if (x->x_gui.label_vis)
+						sys_vgui("destroy %s\n", lh->h_pathname);
+
+					sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
+						lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
+					sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxBNG}\n",
+						canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
+						x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
+						LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
+						lh->h_pathname, x, x);
+					sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name); 
+					x->x_gui.label_vis = 1;
+				}
 			}
 
 			sys_vgui(".x%lx.c addtag selected withtag %lxBNG\n", canvas, x);
diff --git a/src/g_graph.c b/src/g_graph.c
index f6bbd110a..42bcfd9e0 100644
--- a/src/g_graph.c
+++ b/src/g_graph.c
@@ -1048,6 +1048,27 @@ static void graph_getrect(t_gobj *z, t_glist *glist,
     *yp2 = y2;
 }
 
+static void graph_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy)
+{
+    t_glist *x = (t_glist *)z;
+    if (!x->gl_isgraph)
+        text_widgetbehavior.w_displacefn(z, glist, dx, dy);
+    else
+    {
+        x->gl_obj.te_xpix += dx;
+        x->gl_obj.te_ypix += dy;
+		/*char tag[80];
+		sprintf(tag, "%s", rtext_gettag(glist_findrtext((x->gl_owner ? x->gl_owner: x), &x->gl_obj)));
+        sys_vgui(".x%lx.c move %s %d %d\n",
+            glist_getcanvas(x->gl_owner), tag, dx, dy);
+        sys_vgui(".x%lx.c move %sR %d %d\n",
+            glist_getcanvas(x->gl_owner), tag, dx, dy);*/
+        //glist_redraw(x);
+		//gobj_select(z, glist, 1);
+        canvas_fixlinesfor(glist_getcanvas(glist), &x->gl_obj);
+    }
+}
+
 static void graph_displace(t_gobj *z, t_glist *glist, int dx, int dy)
 {
     t_glist *x = (t_glist *)z;
@@ -1090,6 +1111,11 @@ static void graph_select(t_gobj *z, t_glist *glist, int state)
         sys_vgui(".x%lx.c itemconfigure %s -fill %s\n",
                  glist, rtext_gettag(y), 
                  (state? "$select_color" : "black"));
+		t_gobj *g;
+		if (x->gl_list)
+			for (g = x->gl_list; g; g = g->g_next)
+				gobj_select(g, x, state);
+		sys_vgui("pdtk_select_all_gop_widgets .x%lx %s %d\n", glist, rtext_gettag(glist_findrtext(glist, &x->gl_obj)), state);
     }
 }
 
@@ -1213,7 +1239,7 @@ t_widgetbehavior graph_widgetbehavior =
     graph_delete,
     graph_vis,
     graph_click,
-	NULL,
+	graph_displace_withtag,
 };
 
     /* find the graph most recently added to this glist;
diff --git a/src/g_hdial.c b/src/g_hdial.c
index 98c25eaac..bdad64b7b 100644
--- a/src/g_hdial.c
+++ b/src/g_hdial.c
@@ -281,42 +281,47 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
 		    }
 		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
 
-			if (x->x_gui.scale_vis)
-				sys_vgui("destroy %s\n", sh->h_pathname);
-
-			sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
-				 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
-			sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxHRDO}\n",
-				 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w * x->x_number - SCALEHANDLE_WIDTH - 1,
-				 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
-				 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
-				 sh->h_pathname, x, x);
-			sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			x->x_gui.scale_vis = 1;
-			if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
-			{
-				if (x->x_gui.label_vis)
-					sys_vgui("destroy %s\n", lh->h_pathname);
-
-				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
-					lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
-				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxHRDO}\n",
-					canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
-					x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
-					LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
-					lh->h_pathname, x, x);
+			// check if we are drawing inside a gop abstraction visible on parent canvas
+			// if so, disable drawing of the handles
+			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
+
+				if (x->x_gui.scale_vis)
+					sys_vgui("destroy %s\n", sh->h_pathname);
+
+				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
+					 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
+				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxHRDO}\n",
+					 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w * x->x_number - SCALEHANDLE_WIDTH - 1,
+					 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
+					 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
+					 sh->h_pathname, x, x);
 				sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name); 
-				x->x_gui.label_vis = 1;
+					 sh->h_pathname, sh->h_bindsym->s_name);
+				x->x_gui.scale_vis = 1;
+				if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
+				{
+					if (x->x_gui.label_vis)
+						sys_vgui("destroy %s\n", lh->h_pathname);
+
+					sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
+						lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
+					sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxHRDO}\n",
+						canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
+						x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
+						LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
+						lh->h_pathname, x, x);
+					sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name); 
+					x->x_gui.label_vis = 1;
+				}
 			}
 
 			sys_vgui(".x%lx.c addtag selected withtag %lxHRDO\n", canvas, x);
diff --git a/src/g_hslider.c b/src/g_hslider.c
index dadf974b6..2c8fc4108 100644
--- a/src/g_hslider.c
+++ b/src/g_hslider.c
@@ -264,43 +264,48 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist)
 		    sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x);
 		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
 
-			if (x->x_gui.scale_vis)
-				sys_vgui("destroy %s\n", sh->h_pathname);
-
-			sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
-				 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
-			sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxHSLDR}\n",
-				 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w + 2 - SCALEHANDLE_WIDTH - 1,
-				 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
-				 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
-				 sh->h_pathname, x, x);
-			sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			x->x_gui.scale_vis = 1;
-
-			if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
-			{
-				if (x->x_gui.label_vis)
-					sys_vgui("destroy %s\n", lh->h_pathname);
-
-				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
-					lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
-				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxHSLDR}\n",
-					canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
-					x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
-					LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
-					lh->h_pathname, x, x);
+			// check if we are drawing inside a gop abstraction visible on parent canvas
+			// if so, disable drawing of the handles
+			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
+
+				if (x->x_gui.scale_vis)
+					sys_vgui("destroy %s\n", sh->h_pathname);
+
+				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
+					 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
+				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxHSLDR}\n",
+					 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w + 2 - SCALEHANDLE_WIDTH - 1,
+					 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
+					 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
+					 sh->h_pathname, x, x);
 				sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name); 
-				x->x_gui.label_vis = 1;
+					 sh->h_pathname, sh->h_bindsym->s_name);
+				x->x_gui.scale_vis = 1;
+
+				if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
+				{
+					if (x->x_gui.label_vis)
+						sys_vgui("destroy %s\n", lh->h_pathname);
+
+					sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
+						lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
+					sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxHSLDR}\n",
+						canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
+						x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
+						LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
+						lh->h_pathname, x, x);
+					sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name); 
+					x->x_gui.label_vis = 1;
+				}
 			}
 
 			sys_vgui(".x%lx.c addtag selected withtag %lxHSLDR\n", canvas, x);
diff --git a/src/g_mycanvas.c b/src/g_mycanvas.c
index 00606659a..4e8833505 100644
--- a/src/g_mycanvas.c
+++ b/src/g_mycanvas.c
@@ -144,43 +144,48 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
 		{
 		    sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x);
 
-			if (x->x_gui.scale_vis)
-				sys_vgui("destroy %s\n", sh->h_pathname);
-
-			sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
-				 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
-			sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxMYCNV}\n",
-				 canvas, x->x_gui.x_obj.te_xpix + x->x_vis_w - SCALEHANDLE_WIDTH - 1,
-				 x->x_gui.x_obj.te_ypix + x->x_vis_h - SCALEHANDLE_HEIGHT - 1,
-				 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
-				 sh->h_pathname, x, x);
-			sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			x->x_gui.scale_vis = 1;
-
-			if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
-			{
-				if (x->x_gui.label_vis)
-					sys_vgui("destroy %s\n", lh->h_pathname);
-
-				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
-					lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
-				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxMYCNV}\n",
-					canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
-					x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
-					LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
-					lh->h_pathname, x, x);
+			// check if we are drawing inside a gop abstraction visible on parent canvas
+			// if so, disable drawing of the handles
+			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
+
+				if (x->x_gui.scale_vis)
+					sys_vgui("destroy %s\n", sh->h_pathname);
+
+				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
+					 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
+				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxMYCNV}\n",
+					 canvas, x->x_gui.x_obj.te_xpix + x->x_vis_w - SCALEHANDLE_WIDTH - 1,
+					 x->x_gui.x_obj.te_ypix + x->x_vis_h - SCALEHANDLE_HEIGHT - 1,
+					 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
+					 sh->h_pathname, x, x);
 				sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name); 
-				x->x_gui.label_vis = 1;
+					 sh->h_pathname, sh->h_bindsym->s_name);
+				x->x_gui.scale_vis = 1;
+
+				if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
+				{
+					if (x->x_gui.label_vis)
+						sys_vgui("destroy %s\n", lh->h_pathname);
+
+					sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
+						lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
+					sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxMYCNV}\n",
+						canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
+						x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
+						LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
+						lh->h_pathname, x, x);
+					sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name); 
+					x->x_gui.label_vis = 1;
+				}
 			}
 
 			sys_vgui(".x%lx.c addtag selected withtag %lxMYCNV\n", canvas, x);
diff --git a/src/g_numbox.c b/src/g_numbox.c
index 6d2829035..ab4c8b0b0 100644
--- a/src/g_numbox.c
+++ b/src/g_numbox.c
@@ -444,42 +444,47 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist)
 		    sys_vgui(".x%lx.c itemconfigure %lxNUMBER -fill $select_color\n",
 		        canvas, x);
 
-			if (x->x_gui.scale_vis)
-				sys_vgui("destroy %s\n", sh->h_pathname);
-
-			sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
-				 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
-			sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxNUM}\n",
-				 canvas, x->x_gui.x_obj.te_xpix + x->x_numwidth - SCALEHANDLE_WIDTH - 1,
-				 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
-				 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
-				 sh->h_pathname, x, x);
-			sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			x->x_gui.scale_vis = 1;
-			if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
-			{
-				if (x->x_gui.label_vis)
-					sys_vgui("destroy %s\n", lh->h_pathname);
-
-				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
-					lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
-				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxNUM}\n",
-					canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
-					x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
-					LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
-					lh->h_pathname, x, x);
+			// check if we are drawing inside a gop abstraction visible on parent canvas
+			// if so, disable drawing of the handles
+			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
+
+				if (x->x_gui.scale_vis)
+					sys_vgui("destroy %s\n", sh->h_pathname);
+
+				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
+					 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
+				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxNUM}\n",
+					 canvas, x->x_gui.x_obj.te_xpix + x->x_numwidth - SCALEHANDLE_WIDTH - 1,
+					 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
+					 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
+					 sh->h_pathname, x, x);
 				sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name); 
-				x->x_gui.label_vis = 1;
+					 sh->h_pathname, sh->h_bindsym->s_name);
+				x->x_gui.scale_vis = 1;
+				if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
+				{
+					if (x->x_gui.label_vis)
+						sys_vgui("destroy %s\n", lh->h_pathname);
+
+					sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
+						lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
+					sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxNUM}\n",
+						canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
+						x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
+						LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
+						lh->h_pathname, x, x);
+					sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name); 
+					x->x_gui.label_vis = 1;
+				}
 			}
 
 			sys_vgui(".x%lx.c addtag selected withtag %lxNUM\n", canvas, x);
diff --git a/src/g_text.c b/src/g_text.c
index 664720d60..0d57d6302 100644
--- a/src/g_text.c
+++ b/src/g_text.c
@@ -1210,8 +1210,8 @@ static void gatom_displace_withtag(t_gobj *z, t_glist *glist,
 {
     t_gatom *x = (t_gatom*)z;
     text_displace_withtag(z, glist, dx, dy);
-    sys_vgui(".x%lx.c move %lx.l %d %d\n", glist_getcanvas(glist), 
-        x, dx, dy);
+    //sys_vgui(".x%lx.c move %lx.l %d %d\n", glist_getcanvas(glist), 
+    //    x, dx, dy);
 }
 
 static void text_select(t_gobj *z, t_glist *glist, int state)
@@ -1227,9 +1227,17 @@ static void text_select(t_gobj *z, t_glist *glist, int state)
     if (glist_isvisible(glist) && gobj_shouldvis(&x->te_g, glist)) {
         sys_vgui(".x%lx.c itemconfigure %sR -outline %s\n", glist_getcanvas(glist), 
                  rtext_gettag(y), (state? "$select_color" : outline));
+		if (z->g_pd == gatom_class) {
+    		sys_vgui("catch {.x%lx.c itemconfigure %lx.l -fill %s}\n", glist_getcanvas(glist), 
+				x, (state? "$select_color" : "$text_color"));
+		}
 		if (z->g_pd->c_wb && z->g_pd->c_wb->w_displacefnwtag) {
 			int i, ni, no;
 			if (state) {
+				if (z->g_pd == gatom_class) {
+					sys_vgui(".x%lx.c addtag selected withtag %lx.l\n",
+						glist_getcanvas(glist), x);					
+				}
 		    	sys_vgui(".x%lx.c addtag selected withtag %sR \n",
 		    	    glist_getcanvas(glist), rtext_gettag(y));
 
@@ -1250,6 +1258,10 @@ static void text_select(t_gobj *z, t_glist *glist, int state)
         	    		glist_getcanvas(glist), rtext_gettag(y), i);
 				}
 			} else {
+				if (z->g_pd == gatom_class) {
+					sys_vgui(".x%lx.c dtag %lx.l selected\n",
+						glist_getcanvas(glist), x);					
+				}
 		    	sys_vgui(".x%lx.c dtag %sR selected\n",
 		        	glist_getcanvas(glist), rtext_gettag(y));
 
diff --git a/src/g_toggle.c b/src/g_toggle.c
index 8cd5bb475..5b6252280 100644
--- a/src/g_toggle.c
+++ b/src/g_toggle.c
@@ -265,43 +265,48 @@ void toggle_draw_select(t_toggle* x, t_glist* glist)
 		    sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x);
 		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
 
-			if (x->x_gui.scale_vis)
-				sys_vgui("destroy %s\n", sh->h_pathname);
-
-			sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
-				 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
-			sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxTGL}\n",
-				 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
-				 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
-				 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
-				 sh->h_pathname, x, x);
-			sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			x->x_gui.scale_vis = 1;
-
-			if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
-			{
-				if (x->x_gui.label_vis)
-					sys_vgui("destroy %s\n", lh->h_pathname);
-
-				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
-					lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
-				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxTGL}\n",
-					canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
-					x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
-					LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
-					lh->h_pathname, x, x);
+		// check if we are drawing inside a gop abstraction visible on parent canvas
+		// if so, disable drawing of the handles
+		if (x->x_gui.x_glist == glist_getcanvas(glist)) {
+
+				if (x->x_gui.scale_vis)
+					sys_vgui("destroy %s\n", sh->h_pathname);
+
+				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
+					 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
+				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxTGL}\n",
+					 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
+					 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
+					 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
+					 sh->h_pathname, x, x);
 				sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
-				x->x_gui.label_vis = 1;
+					 sh->h_pathname, sh->h_bindsym->s_name);
+				x->x_gui.scale_vis = 1;
+
+				if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
+				{
+					if (x->x_gui.label_vis)
+						sys_vgui("destroy %s\n", lh->h_pathname);
+
+					sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
+						lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
+					sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxTGL}\n",
+						canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
+						x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
+						LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
+						lh->h_pathname, x, x);
+					sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					x->x_gui.label_vis = 1;
+				}
 			}
 
 			sys_vgui(".x%lx.c addtag selected withtag %lxTGL\n", canvas, x);
diff --git a/src/g_vdial.c b/src/g_vdial.c
index f23e3db72..de0f68545 100644
--- a/src/g_vdial.c
+++ b/src/g_vdial.c
@@ -280,43 +280,48 @@ void vradio_draw_select(t_vradio* x, t_glist* glist)
 		    }
 		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
 
-			if (x->x_gui.scale_vis)
-				sys_vgui("destroy %s\n", sh->h_pathname);
-
-			sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
-				 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
-			sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxVRDO}\n",
-				 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
-				 x->x_gui.x_obj.te_ypix + x->x_gui.x_h * x->x_number - SCALEHANDLE_HEIGHT - 1,
-				 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
-				 sh->h_pathname, x, x);
-			sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			x->x_gui.scale_vis = 1;
-
-			if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
-			{
-				if (x->x_gui.label_vis)
-					sys_vgui("destroy %s\n", lh->h_pathname);
-
-				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
-					lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
-				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxVDRO}\n",
-					canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
-					x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
-					LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
-					lh->h_pathname, x, x);
+			// check if we are drawing inside a gop abstraction visible on parent canvas
+			// if so, disable drawing of the handles
+			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
+
+				if (x->x_gui.scale_vis)
+					sys_vgui("destroy %s\n", sh->h_pathname);
+
+				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
+					 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
+				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxVRDO}\n",
+					 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
+					 x->x_gui.x_obj.te_ypix + x->x_gui.x_h * x->x_number - SCALEHANDLE_HEIGHT - 1,
+					 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
+					 sh->h_pathname, x, x);
 				sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name); 
-				x->x_gui.label_vis = 1;
+					 sh->h_pathname, sh->h_bindsym->s_name);
+				x->x_gui.scale_vis = 1;
+
+				if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
+				{
+					if (x->x_gui.label_vis)
+						sys_vgui("destroy %s\n", lh->h_pathname);
+
+					sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
+						lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
+					sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxVDRO}\n",
+						canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
+						x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
+						LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
+						lh->h_pathname, x, x);
+					sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name); 
+					x->x_gui.label_vis = 1;
+				}
 			}
 
 			sys_vgui(".x%lx.c addtag selected withtag %lxVRDO\n", canvas, x);
diff --git a/src/g_vslider.c b/src/g_vslider.c
index a1e263fb0..7c1274428 100644
--- a/src/g_vslider.c
+++ b/src/g_vslider.c
@@ -255,43 +255,48 @@ static void vslider_draw_select(t_vslider *x, t_glist *glist)
 		    sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x);
 		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
 
-			if (x->x_gui.scale_vis)
-				sys_vgui("destroy %s\n", sh->h_pathname);
-
-			sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
-				 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
-			sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxVSLDR}\n",
-				 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
-				 x->x_gui.x_obj.te_ypix + 3 + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
-				 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
-				 sh->h_pathname, x, x);
-			sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			x->x_gui.scale_vis = 1;
-
-			if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
-			{
-				if (x->x_gui.label_vis)
-					sys_vgui("destroy %s\n", lh->h_pathname);
-
-				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
-					lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
-				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxVSLDR}\n",
-					canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
-					x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
-					LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
-					lh->h_pathname, x, x);
+			// check if we are drawing inside a gop abstraction visible on parent canvas
+			// if so, disable drawing of the handles
+			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
+
+				if (x->x_gui.scale_vis)
+					sys_vgui("destroy %s\n", sh->h_pathname);
+
+				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
+					 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
+				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxVSLDR}\n",
+					 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
+					 x->x_gui.x_obj.te_ypix + 3 + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
+					 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
+					 sh->h_pathname, x, x);
 				sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name); 
-				x->x_gui.label_vis = 1;
+					 sh->h_pathname, sh->h_bindsym->s_name);
+				x->x_gui.scale_vis = 1;
+
+				if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
+				{
+					if (x->x_gui.label_vis)
+						sys_vgui("destroy %s\n", lh->h_pathname);
+
+					sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
+						lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
+					sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxVSLDR}\n",
+						canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
+						x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
+						LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
+						lh->h_pathname, x, x);
+					sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name); 
+					x->x_gui.label_vis = 1;
+				}
 			}
 
 			sys_vgui(".x%lx.c addtag selected withtag %lxVSLDR\n", canvas, x);
diff --git a/src/g_vumeter.c b/src/g_vumeter.c
index 891fb37cf..f0a8e8f56 100644
--- a/src/g_vumeter.c
+++ b/src/g_vumeter.c
@@ -471,42 +471,47 @@ static void vu_draw_select(t_vu* x,t_glist* glist)
 		    }
 		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
 
-			if (x->x_gui.scale_vis)
-				sys_vgui("destroy %s\n", sh->h_pathname);
-
-			sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
-				 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
-			sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxVU}\n",
-				 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w + 1 - SCALEHANDLE_WIDTH - 1,
-				 x->x_gui.x_obj.te_ypix + x->x_gui.x_h + 2 - SCALEHANDLE_HEIGHT - 1,
-				 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
-				 sh->h_pathname, x, x);
-			sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-				 sh->h_pathname, sh->h_bindsym->s_name);
-			x->x_gui.scale_vis = 1;
-			if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
-			{
-				if (x->x_gui.label_vis)
-					sys_vgui("destroy %s\n", lh->h_pathname);
-
-				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
-					lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
-				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxVU}\n",
-					canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
-					x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
-					LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
-					lh->h_pathname, x, x);
+			// check if we are drawing inside a gop abstraction visible on parent canvas
+			// if so, disable drawing of the handles
+			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
+
+				if (x->x_gui.scale_vis)
+					sys_vgui("destroy %s\n", sh->h_pathname);
+
+				sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
+					 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
+				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxVU}\n",
+					 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w + 1 - SCALEHANDLE_WIDTH - 1,
+					 x->x_gui.x_obj.te_ypix + x->x_gui.x_h + 2 - SCALEHANDLE_HEIGHT - 1,
+					 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
+					 sh->h_pathname, x, x);
 				sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name);
+					 sh->h_pathname, sh->h_bindsym->s_name);
 				sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-					lh->h_pathname, lh->h_bindsym->s_name); 
-				x->x_gui.label_vis = 1;
+					 sh->h_pathname, sh->h_bindsym->s_name);
+				x->x_gui.scale_vis = 1;
+				if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
+				{
+					if (x->x_gui.label_vis)
+						sys_vgui("destroy %s\n", lh->h_pathname);
+
+					sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
+						lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
+					sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxVU}\n",
+						canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
+						x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
+						LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
+						lh->h_pathname, x, x);
+					sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name);
+					sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+						lh->h_pathname, lh->h_bindsym->s_name); 
+					x->x_gui.label_vis = 1;
+				}
 			}
 
 			sys_vgui(".x%lx.c addtag selected withtag %lxVU\n", canvas, x);
diff --git a/src/pd.tk b/src/pd.tk
index 793d2d635..072fe1bbb 100644
--- a/src/pd.tk
+++ b/src/pd.tk
@@ -2896,6 +2896,24 @@ proc pdtk_canvas_mouseup {name x y b} {
 #	after 40 [list pdtk_canvas_getscroll_ping $name]
 #}
 
+proc pdtk_select_all_gop_widgets {name gop state} {
+	#puts stderr "======================$name"
+	foreach item [$name.c find all] {
+		#puts stderr [$name.c gettags $item]
+		foreach tag [$name.c gettags $item] {
+			if { [string first $gop $tag] > -1 } {
+				#puts stderr ...match
+				#$name.c delete $item
+				if {$state} {
+					$name.c addtag selected withtag $tag
+				} else {
+					$name.c dtag $tag selected
+				}
+			}
+		}
+	}
+}
+
 proc pdtk_canvas_getscroll {name} {
 	global pd_nt
     global pdtk_canvas_mouseup_name
-- 
GitLab