From dc1ae32be53ed1ee8ba4a7c7ba0a8cdad70fbe4c Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Thu, 10 Dec 2015 21:31:51 -0500
Subject: [PATCH] revised Ivica's fudge factors to get iemguis in a gop to show
 up correctly in legacy mode

---
 pd/src/g_bang.c     | 2 +-
 pd/src/g_mycanvas.c | 2 +-
 pd/src/g_numbox.c   | 2 +-
 pd/src/g_radio.c    | 2 +-
 pd/src/g_slider.c   | 4 ++--
 pd/src/g_toggle.c   | 2 +-
 pd/src/g_vumeter.c  | 5 +++--
 7 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c
index 0f13be915..c059f2c32 100644
--- a/pd/src/g_bang.c
+++ b/pd/src/g_bang.c
@@ -479,7 +479,7 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_changed = -1;
 
     x->x_gui.legacy_x = 0;
-    x->x_gui.legacy_y = 2;
+    x->x_gui.legacy_y = 0;
 
     //x->x_gui.click_x = 1;
     //x->x_gui.click_y = 2;
diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c
index e8278a3a2..283be8c72 100644
--- a/pd/src/g_mycanvas.c
+++ b/pd/src/g_mycanvas.c
@@ -385,7 +385,7 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_obj.te_iemgui = 1;
 
     x->x_gui.legacy_x = 0;
-    x->x_gui.legacy_y = 2;
+    x->x_gui.legacy_y = 0;
 
     return (x);
 }
diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c
index 197af3980..b1a6bba23 100644
--- a/pd/src/g_numbox.c
+++ b/pd/src/g_numbox.c
@@ -838,7 +838,7 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_changed = 0;
 
     x->x_gui.legacy_x = 0;
-    x->x_gui.legacy_y = 2;
+    x->x_gui.legacy_y = 0;
 
     return (x);
 }
diff --git a/pd/src/g_radio.c b/pd/src/g_radio.c
index 6f0bd6f16..9828355f5 100644
--- a/pd/src/g_radio.c
+++ b/pd/src/g_radio.c
@@ -534,7 +534,7 @@ static void *radio_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_obj.te_iemgui = 1;
 
     x->x_gui.legacy_x = 0;
-    x->x_gui.legacy_y = 2;   
+    x->x_gui.legacy_y = 0;   
 
     return (x);
 }
diff --git a/pd/src/g_slider.c b/pd/src/g_slider.c
index 75045a03b..d73b21832 100644
--- a/pd/src/g_slider.c
+++ b/pd/src/g_slider.c
@@ -598,10 +598,10 @@ static void *slider_new(t_symbol *s, int argc, t_atom *argv)
     if (x->x_orient)
     {
         x->x_gui.legacy_x = 0;
-        x->x_gui.legacy_y = 0;
+        x->x_gui.legacy_y = -2;
     } else {
         x->x_gui.legacy_x = -3;
-        x->x_gui.legacy_y = 2;        
+        x->x_gui.legacy_y = 0;        
     }
 
 
diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c
index c81db5214..e7de443cb 100644
--- a/pd/src/g_toggle.c
+++ b/pd/src/g_toggle.c
@@ -397,7 +397,7 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_changed = 1;
 
     x->x_gui.legacy_x = 0;
-    x->x_gui.legacy_y = 2;
+    x->x_gui.legacy_y = 0;
 
     //x->x_gui.click_x = 1;
     //x->x_gui.click_y = 2;
diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c
index 5c434f91a..324986f35 100644
--- a/pd/src/g_vumeter.c
+++ b/pd/src/g_vumeter.c
@@ -450,7 +450,8 @@ static void vu_getrect(t_gobj *z, t_glist *glist,
 
     iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
 
-    if (x->x_scale)
+    /* In legacy mode we don't include the scale in the rect */
+    if (x->x_scale && !sys_legacy)
     {
         //vu has custom scale all labels unlike other iemgui object
         end=x1+x->x_gui.x_w+4;
@@ -748,7 +749,7 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_obj.te_iemgui = 1;
 
     x->x_gui.legacy_x = -1;
-    x->x_gui.legacy_y = 0;
+    x->x_gui.legacy_y = -2;
 
     return (x);
 }
-- 
GitLab