From 818b89c23af01462b4d4c14e2c631e0ef9d844e6 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Sat, 25 Feb 2012 18:49:41 -0500
Subject: [PATCH] fixed all iemgui objects to conform to the new model of gop
 selection (no highlighting of objects inside gop unless they are toplevel
 objects)

---
 src/g_bang.c     | 10 +++++-----
 src/g_hdial.c    | 14 +++++++-------
 src/g_hslider.c  |  8 ++++----
 src/g_mycanvas.c |  6 +++---
 src/g_numbox.c   | 19 ++++++++++---------
 src/g_toggle.c   |  9 +++++----
 src/g_vdial.c    | 13 +++++++------
 src/g_vslider.c  |  8 ++++----
 src/g_vumeter.c  | 32 ++++++++++++++++----------------
 9 files changed, 61 insertions(+), 58 deletions(-)

diff --git a/src/g_bang.c b/src/g_bang.c
index 3ef86a8b5..5d6e21f35 100644
--- a/src/g_bang.c
+++ b/src/g_bang.c
@@ -244,14 +244,14 @@ void bng_draw_select(t_bng* x, t_glist* glist)
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
-		    sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x);
-		    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);
-
 			// check if we are drawing inside a gop abstraction visible on parent canvas
-			// if so, disable drawing of the handles
+			// if so, disable highlighting
 			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
 
+				sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x);
+				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);
 
diff --git a/src/g_hdial.c b/src/g_hdial.c
index bdad64b7b..b0d29495c 100644
--- a/src/g_hdial.c
+++ b/src/g_hdial.c
@@ -275,16 +275,16 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
-		    for(i=0; i<n; i++)
-		    {
-		        sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline $select_color\n", canvas, x, i);
-		    }
-		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
-
 			// check if we are drawing inside a gop abstraction visible on parent canvas
-			// if so, disable drawing of the handles
+			// if so, disable highlighting
 			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
 
+				for(i=0; i<n; i++)
+				{
+				    sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline $select_color\n", canvas, x, i);
+				}
+				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);
 
diff --git a/src/g_hslider.c b/src/g_hslider.c
index 2c8fc4108..9c13f940d 100644
--- a/src/g_hslider.c
+++ b/src/g_hslider.c
@@ -261,13 +261,13 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist)
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
-		    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);
-
 			// check if we are drawing inside a gop abstraction visible on parent canvas
-			// if so, disable drawing of the handles
+			// if so, disable highlighting
 			if (x->x_gui.x_glist == glist_getcanvas(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);
 
diff --git a/src/g_mycanvas.c b/src/g_mycanvas.c
index d5c0b817b..127b74fdb 100644
--- a/src/g_mycanvas.c
+++ b/src/g_mycanvas.c
@@ -142,12 +142,12 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
-		    sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x);
-
 			// check if we are drawing inside a gop abstraction visible on parent canvas
-			// if so, disable drawing of the handles
+			// if so, disable highlighting
 			if (x->x_gui.x_glist == glist_getcanvas(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);
 
diff --git a/src/g_numbox.c b/src/g_numbox.c
index ab4c8b0b0..c2390526c 100644
--- a/src/g_numbox.c
+++ b/src/g_numbox.c
@@ -435,19 +435,20 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist)
 		        x->x_buf[0] = 0;
 		        sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
 		    }
-		    sys_vgui(".x%lx.c itemconfigure %lxBASE1 -outline $select_color\n",
-		        canvas, x);
-		    sys_vgui(".x%lx.c itemconfigure %lxBASE2 -fill $select_color\n",
-		        canvas, x);
-		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n",
-		        canvas, x);
-		    sys_vgui(".x%lx.c itemconfigure %lxNUMBER -fill $select_color\n",
-		        canvas, x);
 
 			// check if we are drawing inside a gop abstraction visible on parent canvas
-			// if so, disable drawing of the handles
+			// if so, disable highlighting
 			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
 
+				sys_vgui(".x%lx.c itemconfigure %lxBASE1 -outline $select_color\n",
+				    canvas, x);
+				sys_vgui(".x%lx.c itemconfigure %lxBASE2 -fill $select_color\n",
+				    canvas, x);
+				sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n",
+				    canvas, x);
+				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);
 
diff --git a/src/g_toggle.c b/src/g_toggle.c
index 5b6252280..9f541a0d5 100644
--- a/src/g_toggle.c
+++ b/src/g_toggle.c
@@ -262,13 +262,14 @@ void toggle_draw_select(t_toggle* x, t_glist* glist)
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
+
+			// check if we are drawing inside a gop abstraction visible on parent canvas
+			// if so, disable highlighting
+			if (x->x_gui.x_glist == glist_getcanvas(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);
 
-		// 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);
 
diff --git a/src/g_vdial.c b/src/g_vdial.c
index de0f68545..ba8e5b3ae 100644
--- a/src/g_vdial.c
+++ b/src/g_vdial.c
@@ -274,16 +274,17 @@ void vradio_draw_select(t_vradio* x, t_glist* glist)
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
-		    for(i=0; i<n; i++)
-		    {
-		        sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline $select_color\n", canvas, x, i);
-		    }
-		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
 
 			// check if we are drawing inside a gop abstraction visible on parent canvas
-			// if so, disable drawing of the handles
+			// if so, disable highlighting
 			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
 
+				for(i=0; i<n; i++)
+				{
+				    sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline $select_color\n", canvas, x, i);
+				}
+				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);
 
diff --git a/src/g_vslider.c b/src/g_vslider.c
index 7c1274428..c8316fba1 100644
--- a/src/g_vslider.c
+++ b/src/g_vslider.c
@@ -252,13 +252,13 @@ static void vslider_draw_select(t_vslider *x, t_glist *glist)
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
-		    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);
-
 			// check if we are drawing inside a gop abstraction visible on parent canvas
-			// if so, disable drawing of the handles
+			// if so, disable highlighting
 			if (x->x_gui.x_glist == glist_getcanvas(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);
 
diff --git a/src/g_vumeter.c b/src/g_vumeter.c
index f0a8e8f56..412193046 100644
--- a/src/g_vumeter.c
+++ b/src/g_vumeter.c
@@ -456,25 +456,25 @@ static void vu_draw_select(t_vu* x,t_glist* glist)
 
 		if(x->x_gui.x_fsf.x_selected)
 		{
-		    sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x);
-		    for(i=1; i<=IEM_VU_STEPS; i++)
-		    {
-		        if(((i+2)&3) && (x->x_scale))
-		            sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -fill $select_color\n",
-		                     canvas, x, i);
-		    }
-		    if(x->x_scale)
-		    {
-		        i=IEM_VU_STEPS+1;
-		        sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -fill $select_color\n",
-		                 canvas, x, i);
-		    }
-		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
-
 			// check if we are drawing inside a gop abstraction visible on parent canvas
-			// if so, disable drawing of the handles
+			// if so, disable highlighting
 			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
 
+				sys_vgui(".x%lx.c itemconfigure %lxBASE -outline $select_color\n", canvas, x);
+				for(i=1; i<=IEM_VU_STEPS; i++)
+				{
+				    if(((i+2)&3) && (x->x_scale))
+				        sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -fill $select_color\n",
+				                 canvas, x, i);
+				}
+				if(x->x_scale)
+				{
+				    i=IEM_VU_STEPS+1;
+				    sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -fill $select_color\n",
+				             canvas, x, i);
+				}
+				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);
 
-- 
GitLab