diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c
index bd108e680d98f0cdd08c66f48cb305cc31f9b71d..4c1d24c1937ffbe3f875ed64b6fe44f345e10044 100644
--- a/pd/src/g_all_guis.c
+++ b/pd/src/g_all_guis.c
@@ -957,6 +957,16 @@ void scalehandle_drag_scale(t_scalehandle *h) {
     }
 }
 
+void iemgui__clickhook3(t_scalehandle *sh, int newstate) {
+    if (!sh->h_dragon && newstate && sh->h_scale)
+        scalehandle_click_scale(sh);
+    else if (sh->h_dragon && newstate == 0 && !sh->h_scale)
+        scalehandle_unclick_label(sh);
+    else if (!sh->h_dragon && newstate && !sh->h_scale)
+        scalehandle_click_label(sh);
+    sh->h_dragon = newstate;
+}
+
 //----------------------------------------------------------------
 // IEMGUI refactor (by Mathieu)
 
diff --git a/pd/src/g_all_guis.h b/pd/src/g_all_guis.h
index 05e991973359cb547830fc695aa52cca11c1173b..748db131ab7ecb89eeff4286a8900136f83e337b 100644
--- a/pd/src/g_all_guis.h
+++ b/pd/src/g_all_guis.h
@@ -120,8 +120,6 @@ typedef struct _scalehandle
     int        h_vis;
 } t_scalehandle;
 
-static t_class *scalehandle_class;
-
 typedef struct _iemgui
 {
     t_object           x_obj;
@@ -176,7 +174,7 @@ typedef struct _bng
     t_clock  *x_clock_lck;
 } t_bng;
 
-typedef struct _hslider
+typedef struct _slider
 {
     t_iemgui x_gui;
     int      x_pos;
@@ -190,18 +188,20 @@ typedef struct _hslider
     double   x_k;
     double   x_last;
     int      x_is_last_float;
-} t_hslider;
+    int      x_orient; // 0=horiz, 1=vert
+} t_slider;
 
-typedef struct _hdial
+typedef struct _radio
 {
     t_iemgui x_gui;
     int      x_on;
-    int      x_on_old;  /* LATER delete this; it's used for old version */
+    int      x_on_old; /* for use by [hdl] [vdl] */
     int      x_change;
     int      x_number;
     int      x_drawn;
     t_atom   x_at[2];
-} t_hdial;
+    int      x_orient; // 0=horiz, 1=vert
+} t_radio;
 
 typedef struct _toggle
 {
@@ -218,22 +218,6 @@ typedef struct _my_canvas
     int      x_vis_h;
 } t_my_canvas;
 
-typedef struct _vslider
-{
-    t_iemgui x_gui;
-    int      x_pos;
-    int      x_val;
-    int      x_center;
-    int      x_thick;
-    int      x_lin0_log1;
-    int      x_steady;
-    double   x_min;
-    double   x_max;
-    double   x_k;
-    double   x_last;
-    int      x_is_last_float;
-} t_vslider;
-
 typedef struct _vu
 {
     t_iemgui x_gui;
@@ -268,20 +252,6 @@ typedef struct _my_numbox
     int      x_hide_frame;  /* 0 default, 1 just arrow, 2, just frame, 3 both */
 } t_my_numbox;
 
-typedef struct _vdial
-{
-    t_iemgui x_gui;
-    int      x_on;
-    int      x_on_old;
-    int      x_change;
-    int      x_number;
-    int      x_drawn;
-    t_atom   x_at[2];
-} t_vdial;
-
-#define t_vradio t_vdial
-#define t_hradio t_hdial
-
 extern int sys_noloadbang;
 extern int iemgui_color_hex[];
 
@@ -335,6 +305,7 @@ EXTERN void scalehandle_click_label(t_scalehandle *h);
 EXTERN void scalehandle_click_scale(t_scalehandle *h);
 EXTERN void scalehandle_unclick_scale(t_scalehandle *h);
 EXTERN void scalehandle_drag_scale(t_scalehandle *h);
+EXTERN void iemgui__clickhook3(t_scalehandle *sh, int newstate);
 
 EXTERN int mini(int a, int b);
 EXTERN int maxi(int a, int b);
@@ -367,4 +338,5 @@ EXTERN void iemgui_class_addmethods(t_class *c);
 EXTERN void scrollbar_update(t_glist *glist);
 
 
+EXTERN void radio_draw_update(t_gobj *client, t_glist *glist);
 
diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c
index 7240ac1b229c2393384d5a788354fd73946f46aa..bb7e8af1df49ad6c9a66af4af308865da77c162a 100644
--- a/pd/src/g_bang.c
+++ b/pd/src/g_bang.c
@@ -5,36 +5,22 @@
 /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
 /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
 
-#include "config.h"
-
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <ctype.h>
 #include "m_pd.h"
 #include "g_canvas.h"
-#include "t_tk.h"
 #include "g_all_guis.h"
 #include <math.h>
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_IO_H
-#include <io.h>
-#endif
-
+static t_class *scalehandle_class;
 extern int gfxstub_haveproperties(void *key);
 void bng_draw_select(t_bng* x, t_glist* glist);
  
-/* --------------- bng     gui-bang ------------------------- */
-
 t_widgetbehavior bng_widgetbehavior;
 static t_class *bng_class;
 
-/*  widget helper functions  */
-
 void bng_draw_update(t_gobj *xgobj, t_glist *glist)
 {
     t_bng *x = (t_bng *)xgobj;
@@ -152,19 +138,7 @@ static void bng__clickhook(t_scalehandle *sh, t_floatarg f,
             scalehandle_unclick_scale(sh);
         }
     }
-    else if (!sh->h_dragon && newstate && sh->h_scale)
-    {
-        scalehandle_click_scale(sh);
-    }
-    else if (sh->h_dragon && newstate == 0 && !sh->h_scale)
-    {
-        scalehandle_unclick_label(sh);
-    }
-    else if (!sh->h_dragon && newstate && !sh->h_scale)
-    {
-        scalehandle_click_label(sh);
-    }
-    sh->h_dragon = newstate;
+    else iemgui__clickhook3(sh,newstate);
 }
 
 static void bng__motionhook(t_scalehandle *sh,
diff --git a/pd/src/g_hdial.c b/pd/src/g_hdial.c
index 8b072ba2aa4a1fd2c6694e51255bebea122fe0f5..8b137891791fe96927ad78e64b0aad7bded08bdc 100644
--- a/pd/src/g_hdial.c
+++ b/pd/src/g_hdial.c
@@ -1,695 +1 @@
-/* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
 
-/* vdial.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
-/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
-
-/* name change to vradio by MSP (it's a radio button really) and changed to
-put out a "float" as in sliders, toggles, etc. */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include "m_pd.h"
-#include "g_canvas.h"
-#include "t_tk.h"
-#include "g_all_guis.h"
-#include <math.h>
-
-extern int gfxstub_haveproperties(void *key);
-void hradio_draw_select(t_hradio* x, t_glist* glist);
-
-/* ------------- hdl     gui-horicontal dial ---------------------- */
-
-t_widgetbehavior hradio_widgetbehavior;
-static t_class *hradio_class, *hradio_old_class;
-
-/* widget helper functions */
-
-void hradio_draw_update(t_gobj *client, t_glist *glist)
-{
-    t_hradio *x = (t_hradio *)client;
-    if(!glist_isvisible(glist)) return;
-    t_canvas *canvas=glist_getcanvas(glist);
-    sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n",
-        canvas, x, x->x_drawn, x->x_gui.x_bcol, x->x_gui.x_bcol);
-    sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n",
-        canvas, x, x->x_on,    x->x_gui.x_fcol, x->x_gui.x_fcol);
-    x->x_drawn = x->x_on;
-}
-void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    iemgui_io_draw(&x->x_gui,canvas,old_snd_rcv_flags);
-}
-void hradio_draw_new(t_hradio *x, t_glist *glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
-    int x1=text_xpix(&x->x_gui.x_obj, glist), xi=x1;
-    int y1=text_ypix(&x->x_gui.x_obj, glist); 
-    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-
-    iemgui_base_draw_new(&x->x_gui, canvas, nlet_tag);
-    scalehandle_draw_new(x->x_gui. x_handle,canvas);
-    scalehandle_draw_new(x->x_gui.x_lhandle,canvas);
-
-    for(i=0; i<n; i++)
-    {
-        if (i) sys_vgui(".x%lx.c create pline %d %d %d %d "
-            "-stroke $pd_colors(iemgui_border) "
-            "-tags {%lxBASE%d %lxBASEL %lxOBJ %s text iemgui border}\n",
-            canvas, xi, y1, xi, y1+d, x, i, x, x, nlet_tag);
-        sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x "
-            "-stroke #%6.6x -tags {%lxBUT%d %lxOBJ %s text iemgui}\n",
-            canvas, xi+s, y1+s, xi+d-s, y1+d-s,
-            (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
-            (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
-            x, i, x, nlet_tag);
-        xi += d;
-        x->x_drawn = x->x_on;
-    }
-    iemgui_label_draw_new(&x->x_gui,canvas,x1,y1,nlet_tag);
-    hradio_draw_io(x,glist,7);
-}
-
-void hradio_draw_move(t_hradio *x, t_glist *glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    if (!glist_isvisible(canvas)) return;
-    int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
-    int x1=text_xpix(&x->x_gui.x_obj, glist), xi=x1;
-    int y1=text_ypix(&x->x_gui.x_obj, glist); 
-    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-    iemgui_base_draw_move(&x->x_gui, canvas, nlet_tag);
-
-    for(i=0; i<n; i++)
-    {
-        sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n",
-                 canvas, x, i, xi, y1, xi, y1+d);
-        sys_vgui(".x%lx.c coords %lxBUT%d %d %d %d %d\n",
-                 canvas, x, i, xi+s,y1+s, xi+d-s, y1+d-s);
-        xi += d;
-    }
-    iemgui_label_draw_move(&x->x_gui,canvas,x1,y1);
-    iemgui_io_draw_move(&x->x_gui,canvas,nlet_tag);
-    if (x->x_gui.x_selected) hradio_draw_select(x, x->x_gui.x_glist);
-}
-
-void hradio_draw_config(t_hradio* x, t_glist* glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    int n=x->x_number, i;
-    iemgui_label_draw_config(&x->x_gui,canvas);
-    iemgui_base_draw_config(&x->x_gui,canvas);
-    for(i=0; i<n; i++)
-    {
-        sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n",
-             canvas, x, i,
-             (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol,
-             (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol);
-    }
-}
-
-void hradio_draw_select(t_hradio* x, t_glist* glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    iemgui_base_draw_config(&x->x_gui,canvas);
-    if(x->x_gui.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))
-        {
-            scalehandle_draw_select2(&x->x_gui,glist,
-                x->x_gui.x_w*x->x_number-1,x->x_gui.x_h-1);
-        }
-    }
-    else
-    {
-        scalehandle_draw_erase2(&x->x_gui,glist);
-    }
-    iemgui_label_draw_select(&x->x_gui,canvas);
-    iemgui_tag_selected(&x->x_gui,canvas);
-}
-
-static void hradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx,
-    t_floatarg yyy)
-{
-    t_hradio *x = (t_hradio *)(sh->h_master);
-    int newstate = (int)f;
-    if (sh->h_dragon && newstate == 0 && sh->h_scale)
-    {
-        canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
-        if (sh->h_dragx || sh->h_dragy)
-        {
-            x->x_gui.x_w += sh->h_dragy;
-            x->x_gui.x_h += sh->h_dragy;
-            canvas_dirty(x->x_gui.x_glist, 1);
-        }
-        if (glist_isvisible(x->x_gui.x_glist))
-        {
-            hradio_draw_move(x, x->x_gui.x_glist);
-            scalehandle_unclick_scale(sh);
-        }
-    }
-    else if (!sh->h_dragon && newstate && sh->h_scale)
-    {
-        scalehandle_click_scale(sh);
-    }
-    else if (sh->h_dragon && newstate == 0 && !sh->h_scale)
-    {
-        scalehandle_unclick_label(sh);
-    }
-    else if (!sh->h_dragon && newstate && !sh->h_scale)
-    {
-        scalehandle_click_label(sh);
-    }
-    sh->h_dragon = newstate;
-}
-
-static void hradio__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2)
-{
-    if (sh->h_dragon && sh->h_scale)
-    {
-        t_hradio *x = (t_hradio *)(sh->h_master);
-        int dx = (int)f1, dy = (int)f2;
-        dx = maxi(dx,(IEM_GUI_MINSIZE-x->x_gui.x_w)*x->x_number);
-        dy = dx/x->x_number;
-        sh->h_dragx = dx;
-        sh->h_dragy = dy;
-        scalehandle_drag_scale(sh);
-
-        int properties = gfxstub_haveproperties((void *)x);
-        if (properties)
-        {
-            int new_w = x->x_gui.x_w + sh->h_dragx;
-            properties_set_field_int(properties,"dim.w_ent",new_w);
-        }
-    }
-    scalehandle_dragon_label(sh,f1,f2);
-}
-
-void hradio_draw(t_hradio *x, t_glist *glist, int mode)
-{
-    if(mode == IEM_GUI_DRAW_MODE_UPDATE)
-        sys_queuegui(x, glist, hradio_draw_update);
-    else if(mode == IEM_GUI_DRAW_MODE_MOVE)
-        hradio_draw_move(x, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_NEW)
-    {
-        hradio_draw_new(x, glist);
-        sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
-    }
-    else if(mode == IEM_GUI_DRAW_MODE_SELECT)
-        hradio_draw_select(x, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_ERASE)
-        iemgui_draw_erase(&x->x_gui, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_CONFIG)
-        hradio_draw_config(x, glist);
-    else if(mode >= IEM_GUI_DRAW_MODE_IO)
-        hradio_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO);
-}
-
-/* ------------------------ hdl widgetbehaviour----------------------------- */
-
-static void hradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1,
-    int *xp2, int *yp2)
-{
-    t_hradio *x = (t_hradio *)z;
-
-    *xp1 = text_xpix(&x->x_gui.x_obj, glist);
-    *yp1 = text_ypix(&x->x_gui.x_obj, glist);
-    *xp2 = *xp1 + x->x_gui.x_w*x->x_number;
-    *yp2 = *yp1 + x->x_gui.x_h;
-
-    iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
-}
-
-static void hradio_save(t_gobj *z, t_binbuf *b)
-{
-    t_hradio *x = (t_hradio *)z;
-    int bflcol[3];
-    t_symbol *srl[3];
-
-    iemgui_save(&x->x_gui, srl, bflcol);
-    binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"),
-                (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
-                (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ?
-                    gensym("hdl") : gensym("hradio")),
-                x->x_gui.x_w,
-                x->x_change, iem_symargstoint(&x->x_gui), x->x_number,
-                srl[0], srl[1], srl[2],
-                x->x_gui.x_ldx, x->x_gui.x_ldy,
-                iem_fstyletoint(&x->x_gui), x->x_gui.x_fontsize,
-                bflcol[0], bflcol[1], bflcol[2], x->x_on);
-    binbuf_addv(b, ";");
-}
-
-static void hradio_properties(t_gobj *z, t_glist *owner)
-{
-    t_hradio *x = (t_hradio *)z;
-    char buf[800];
-    t_symbol *srl[3];
-    int hchange=-1;
-
-    iemgui_properties(&x->x_gui, srl);
-    if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class)
-        hchange = x->x_change;
-    sprintf(buf, "pdtk_iemgui_dialog %%s |hradio| \
-            ----------dimensions(pix):----------- %d %d size: 0 0 empty \
-            empty 0.0 empty 0.0 empty %d \
-            %d new-only new&old %d %d number: %d \
-            {%s} {%s} \
-            {%s} %d %d \
-            %d %d \
-            %d %d %d\n",
-            x->x_gui.x_w, IEM_GUI_MINSIZE,
-            0,/*no_schedule*/
-            hchange, x->x_gui.x_loadinit, -1, x->x_number,
-            srl[0]->s_name, srl[1]->s_name,
-            srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
-            x->x_gui.x_font_style, x->x_gui.x_fontsize,
-            0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol,
-            0xffffff & x->x_gui.x_lcol);
-    gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
-}
-
-static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv)
-{
-    canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
-
-    t_symbol *srl[3];
-    int a = (int)atom_getintarg(0, argc, argv);
-    int chg = (int)atom_getintarg(4, argc, argv);
-    int num = (int)atom_getintarg(6, argc, argv);
-    int sr_flags;
-
-    if(chg != 0) chg = 1;
-    x->x_change = chg;
-    sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
-    x->x_gui.x_w = iemgui_clip_size(a);
-    x->x_gui.x_h = x->x_gui.x_w;
-    if(x->x_number != num)
-    {
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
-        x->x_number = num;
-        if(x->x_on >= x->x_number)
-        {
-            x->x_on = x->x_number - 1;
-            x->x_on_old = x->x_on;
-        }
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
-    }
-    else
-    {
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
-        //(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
-        //canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
-        iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
-    }
-
-    /* forcing redraw of the scale handle */
-    if (x->x_gui.x_selected)
-    {
-        hradio_draw_select(x, x->x_gui.x_glist);
-    }
-    scrollbar_update(x->x_gui.x_glist);
-}
-
-static void hradio_set(t_hradio *x, t_floatarg f)
-{
-    int i=(int)f;
-    int old=x->x_on_old;
-
-    if(i < 0)
-        i = 0;
-    if(i >= x->x_number)
-        i = x->x_number-1;
-    if(x->x_on != x->x_on_old)
-    {
-        old = x->x_on_old;
-        x->x_on_old = x->x_on;
-        x->x_on = i;
-        if (x->x_on != x->x_on_old)
-            (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        x->x_on_old = old;
-    }
-    else
-    {
-        x->x_on = i;
-        if (x->x_on != x->x_on_old)
-            (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-    }
-}
-
-static void hradio_bang(t_hradio *x)
-{
-        /* compatibility with earlier  "hdial" behavior */
-    if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class)
-    {
-        if((x->x_change)&&(x->x_on != x->x_on_old))
-        {
-            SETFLOAT(x->x_at, (t_float)x->x_on_old);
-            SETFLOAT(x->x_at+1, 0.0);
-            outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-                pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-        }
-        x->x_on_old = x->x_on;
-        SETFLOAT(x->x_at, (t_float)x->x_on);
-        SETFLOAT(x->x_at+1, 1.0);
-        outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-            pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-    }
-    else
-    {
-        outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
-        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-            pd_float(x->x_gui.x_snd->s_thing, x->x_on);
-    }
-}
-
-static void hradio_fout(t_hradio *x, t_floatarg f)
-{
-    int i=(int)f;
-
-    if(i < 0)
-        i = 0;
-    if(i >= x->x_number)
-        i = x->x_number-1;
-
-    if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class)
-    {
-        if((x->x_change)&&(i != x->x_on_old))
-        {
-            SETFLOAT(x->x_at, (t_float)x->x_on_old);
-            SETFLOAT(x->x_at+1, 0.0);
-            outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-                pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-        }
-        if(x->x_on != x->x_on_old)
-            x->x_on_old = x->x_on;
-        x->x_on = i;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        x->x_on_old = x->x_on;
-        SETFLOAT(x->x_at, (t_float)x->x_on);
-        SETFLOAT(x->x_at+1, 1.0);
-        outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-            pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-    }
-    else
-    {
-        x->x_on_old = x->x_on;
-        x->x_on = i;
-        if (i != x->x_on_old)
-            (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
-        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-            pd_float(x->x_gui.x_snd->s_thing, x->x_on);
-    }
-}
-
-static void hradio_float(t_hradio *x, t_floatarg f)
-{
-    int i=(int)f;
-
-    if(i < 0)
-        i = 0;
-    if(i >= x->x_number)
-        i = x->x_number-1;
-
-    if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class)
-    {
-        /* compatibility with earlier  "vdial" behavior */
-        if((x->x_change)&&(i != x->x_on_old))
-        {
-            if(x->x_gui.x_put_in2out)
-            {
-                SETFLOAT(x->x_at, (t_float)x->x_on_old);
-                SETFLOAT(x->x_at+1, 0.0);
-                outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-                if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-                    pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-            }
-        }
-        if(x->x_on != x->x_on_old)
-            x->x_on_old = x->x_on;
-        x->x_on = i;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        x->x_on_old = x->x_on;
-        if(x->x_gui.x_put_in2out)
-        {
-            SETFLOAT(x->x_at, (t_float)x->x_on);
-            SETFLOAT(x->x_at+1, 1.0);
-            outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-                pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-        }
-    }
-    else
-    {
-        x->x_on_old = x->x_on;
-        x->x_on = i;
-        if (i != x->x_on_old)
-            (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        if (x->x_gui.x_put_in2out)
-        {
-            outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
-            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-                pd_float(x->x_gui.x_snd->s_thing, x->x_on);
-        }
-    }
-}
-
-static void hradio_click(t_hradio *x, t_floatarg xpos, t_floatarg ypos,
-    t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
-{
-    int xx = (int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
-
-    hradio_fout(x, (t_float)(xx / x->x_gui.x_w));
-}
-
-static int hradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix,
-    int shift, int alt, int dbl, int doit)
-{
-    if(doit)
-    {
-        hradio_click((t_hradio *)z, (t_floatarg)xpix, (t_floatarg)ypix,
-            (t_floatarg)shift, 0, (t_floatarg)alt);
-    }
-    return (1);
-}
-
-static void hradio_loadbang(t_hradio *x)
-{
-    if(!sys_noloadbang && x->x_gui.x_loadinit)
-        hradio_bang(x);
-}
-
-static void hradio_number(t_hradio *x, t_floatarg num)
-{
-    int n=(int)num;
-
-    if(n < 1)
-        n = 1;
-    if(n > IEM_RADIO_MAX)
-        n = IEM_RADIO_MAX;
-    if(n != x->x_number)
-    {
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
-        x->x_number = n;
-        if(x->x_on >= x->x_number)
-            x->x_on = x->x_number - 1;
-        x->x_on_old = x->x_on;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
-    }
-}
-
-static void hradio_size(t_hradio *x, t_symbol *s, int ac, t_atom *av)
-{
-    x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
-    x->x_gui.x_h = x->x_gui.x_w;
-    iemgui_size(&x->x_gui);
-}
-
-static void hradio_init(t_hradio *x, t_floatarg f)
-{
-    x->x_gui.x_loadinit = (f==0.0)?0:1;
-}
-
-static void hradio_double_change(t_hradio *x)
-{x->x_change = 1;}
-
-static void hradio_single_change(t_hradio *x)
-{x->x_change = 0;}
-
-static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
-{
-    t_hradio *x = (t_hradio *)pd_new(old? hradio_old_class : hradio_class);
-    int bflcol[]={-262144, -1, -1};
-    int a=IEM_GUI_DEFAULTSIZE, on=0;
-    int ldx=0, ldy=-8, chg=1, num=8;
-    int fs=10;
-
-    iem_inttosymargs(&x->x_gui, 0);
-    iem_inttofstyle(&x->x_gui, 0);
-
-    if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2)
-       &&IS_A_FLOAT(argv,3)
-       &&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4))
-       &&(IS_A_SYMBOL(argv,5)||IS_A_FLOAT(argv,5))
-       &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6))
-       &&IS_A_FLOAT(argv,7)&&IS_A_FLOAT(argv,8)
-       &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10)&&IS_A_FLOAT(argv,11)
-       &&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13)&&IS_A_FLOAT(argv,14))
-    {
-        a = (int)atom_getintarg(0, argc, argv);
-        chg = (int)atom_getintarg(1, argc, argv);
-        iem_inttosymargs(&x->x_gui, atom_getintarg(2, argc, argv));
-        num = (int)atom_getintarg(3, argc, argv);
-        iemgui_new_getnames(&x->x_gui, 4, argv);
-        ldx = (int)atom_getintarg(7, argc, argv);
-        ldy = (int)atom_getintarg(8, argc, argv);
-        iem_inttofstyle(&x->x_gui, atom_getintarg(9, argc, argv));
-        fs = (int)atom_getintarg(10, argc, argv);
-        bflcol[0] = (int)atom_getintarg(11, argc, argv);
-        bflcol[1] = (int)atom_getintarg(12, argc, argv);
-        bflcol[2] = (int)atom_getintarg(13, argc, argv);
-        on = (int)atom_getintarg(14, argc, argv);
-    }
-    else iemgui_new_getnames(&x->x_gui, 4, 0);
-    x->x_gui.x_draw = (t_iemfunptr)hradio_draw;
-    x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
-    if (x->x_gui.x_font_style<0 || x->x_gui.x_font_style>2) x->x_gui.x_font_style=0;
-    if(num < 1)
-        num = 1;
-    if(num > IEM_RADIO_MAX)
-        num = IEM_RADIO_MAX;
-    x->x_number = num;
-    if(on < 0)
-        on = 0;
-    if(on >= x->x_number)
-        on = x->x_number - 1;
-    if(x->x_gui.x_loadinit)
-        x->x_on = on;
-    else
-        x->x_on = 0;
-    x->x_on_old = x->x_on;
-    x->x_change = (chg==0)?0:1;
-    if (iemgui_has_rcv(&x->x_gui))
-        pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
-    x->x_gui.x_ldx = ldx;
-    x->x_gui.x_ldy = ldy;
-    if(fs < 4)
-        fs = 4;
-    x->x_gui.x_fontsize = fs;
-    x->x_gui.x_w = iemgui_clip_size(a);
-    x->x_gui.x_h = x->x_gui.x_w;
-    iemgui_verify_snd_ne_rcv(&x->x_gui);
-    iemgui_all_colfromload(&x->x_gui, bflcol);
-    outlet_new(&x->x_gui.x_obj, &s_list);
-
-    x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_iemgui *)x,1);
-    x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_iemgui *)x,0);
-    x->x_gui.x_obj.te_iemgui = 1;
-
-    return (x);
-}
-
-static void *hradio_new(t_symbol *s, int argc, t_atom *argv)
-{
-    return (hradio_donew(s, argc, argv, 0));
-}
-
-static void *hdial_new(t_symbol *s, int argc, t_atom *argv)
-{
-    return (hradio_donew(s, argc, argv, 1));
-}
-
-static void hradio_ff(t_hradio *x)
-{
-    if(iemgui_has_rcv(&x->x_gui))
-        pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
-    gfxstub_deleteforkey(x);
-
-    if (x->x_gui. x_handle) scalehandle_free(x->x_gui. x_handle);
-    if (x->x_gui.x_lhandle) scalehandle_free(x->x_gui.x_lhandle);
-}
-
-void g_hradio_setup(void)
-{
-    hradio_class = class_new(gensym("hradio"), (t_newmethod)hradio_new,
-        (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0);
-    class_addbang(hradio_class, hradio_bang);
-    class_addfloat(hradio_class, hradio_float);
-    class_addmethod(hradio_class, (t_method)hradio_click, gensym("click"),
-                    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
-    class_addmethod(hradio_class, (t_method)hradio_dialog, gensym("dialog"),
-                    A_GIMME, 0);
-    class_addmethod(hradio_class, (t_method)hradio_loadbang,
-        gensym("loadbang"), 0);
-    class_addmethod(hradio_class, (t_method)hradio_set,
-        gensym("set"), A_FLOAT, 0);
-    class_addmethod(hradio_class, (t_method)hradio_size,
-        gensym("size"), A_GIMME, 0);
-    iemgui_class_addmethods(hradio_class);
-    class_addmethod(hradio_class, (t_method)hradio_init,
-        gensym("init"), A_FLOAT, 0);
-    class_addmethod(hradio_class, (t_method)hradio_number,
-        gensym("number"), A_FLOAT, 0);
-    class_addmethod(hradio_class, (t_method)hradio_single_change,
-        gensym("single_change"), 0);
-    class_addmethod(hradio_class, (t_method)hradio_double_change,
-        gensym("double_change"), 0);
- 
-    scalehandle_class = class_new(gensym("_scalehandle"), 0, 0,
-                  sizeof(t_scalehandle), CLASS_PD, 0);
-    class_addmethod(scalehandle_class, (t_method)hradio__clickhook,
-            gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
-    class_addmethod(scalehandle_class, (t_method)hradio__motionhook,
-            gensym("_motion"), A_FLOAT, A_FLOAT, 0);
-
-    wb_init(&hradio_widgetbehavior,hradio_getrect,hradio_newclick);
-    class_setwidget(hradio_class, &hradio_widgetbehavior);
-    class_sethelpsymbol(hradio_class, gensym("hradio"));
-    class_setsavefn(hradio_class, hradio_save);
-    class_setpropertiesfn(hradio_class, hradio_properties);
-
-        /*obsolete version (0.34-0.35) */
-    hradio_old_class = class_new(gensym("hdl"), (t_newmethod)hdial_new,
-        (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0);
-    class_addcreator((t_newmethod)hradio_new, gensym("rdb"), A_GIMME, 0);
-    class_addcreator((t_newmethod)hradio_new, gensym("radiobut"), A_GIMME, 0);
-    class_addcreator((t_newmethod)hradio_new, gensym("radiobutton"),
-        A_GIMME, 0);
-    class_addbang(hradio_old_class, hradio_bang);
-    class_addfloat(hradio_old_class, hradio_float);
-    class_addmethod(hradio_old_class, (t_method)hradio_click, gensym("click"),
-                    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
-    class_addmethod(hradio_old_class, (t_method)hradio_dialog, gensym("dialog"),
-                    A_GIMME, 0);
-    class_addmethod(hradio_old_class, (t_method)hradio_loadbang,
-        gensym("loadbang"), 0);
-    class_addmethod(hradio_old_class, (t_method)hradio_set,
-        gensym("set"), A_FLOAT, 0);
-    class_addmethod(hradio_old_class, (t_method)hradio_size,
-        gensym("size"), A_GIMME, 0);
-    iemgui_class_addmethods(hradio_old_class);
-    class_addmethod(hradio_old_class, (t_method)hradio_init,
-        gensym("init"), A_FLOAT, 0);
-    class_addmethod(hradio_old_class, (t_method)hradio_number,
-        gensym("number"), A_FLOAT, 0);
-    class_addmethod(hradio_old_class, (t_method)hradio_single_change,
-        gensym("single_change"), 0);
-    class_addmethod(hradio_old_class, (t_method)hradio_double_change,
-        gensym("double_change"), 0);
-    class_setwidget(hradio_old_class, &hradio_widgetbehavior);
-    class_sethelpsymbol(hradio_old_class, gensym("hradio"));
-}
diff --git a/pd/src/g_hslider.c b/pd/src/g_hslider.c
index 8bfddaf209619ab49b3590e01fb40c726ee324b8..8b137891791fe96927ad78e64b0aad7bded08bdc 100644
--- a/pd/src/g_hslider.c
+++ b/pd/src/g_hslider.c
@@ -1,692 +1 @@
-/* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
 
-/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
-/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include "m_pd.h"
-#include "g_canvas.h"
-#include "t_tk.h"
-#include "g_all_guis.h"
-#include <math.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_IO_H
-#include <io.h>
-#endif
-
-extern int gfxstub_haveproperties(void *key);
-static void hslider_draw_select(t_hslider* x,t_glist* glist);
-
-/* ------------ hsl    gui-horicontal  slider ----------------------- */
-
-t_widgetbehavior hslider_widgetbehavior;
-static t_class *hslider_class;
-
-/* widget helper functions */
-
-static void hslider_draw_update(t_gobj *client, t_glist *glist)
-{
-    t_hslider *x = (t_hslider *)client;
-    if (!x->x_gui.x_changed) return;
-    x->x_gui.x_changed = 0;
-    if (!glist_isvisible(glist)) return;
-    t_canvas *canvas=glist_getcanvas(glist);
-    int y1=text_ypix(&x->x_gui.x_obj, glist);
-    int r = text_xpix(&x->x_gui.x_obj, glist) + 3 + (x->x_val + 50)/100;
-    sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n",
-        canvas, x, r, y1+2, r, y1 + x->x_gui.x_h-2);
-    int t = x->x_thick;
-    x->x_thick = x->x_val == x->x_center;
-    if (t!=x->x_thick)
-        sys_vgui(".x%lx.c itemconfigure %lxKNOB -strokewidth %d\n",
-            canvas, x, 4*x->x_thick+3);
-}
-
-static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    iemgui_io_draw(&x->x_gui,canvas,old_snd_rcv_flags);
-}
-static void hslider_draw_new(t_hslider *x, t_glist *glist)
-{
-    int xpos=text_xpix(&x->x_gui.x_obj, glist);
-    int ypos=text_ypix(&x->x_gui.x_obj, glist);
-    int r = xpos + 3 + (x->x_val + 50)/100;
-    t_canvas *canvas=glist_getcanvas(glist);
-
-    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-    iemgui_base_draw_new(&x->x_gui, canvas, nlet_tag);
-
-    scalehandle_draw_new(x->x_gui. x_handle,canvas);
-    scalehandle_draw_new(x->x_gui.x_lhandle,canvas);
-
-    sys_vgui(".x%lx.c create prect %d %d %d %d "
-        "-stroke $pd_colors(iemgui_border) -fill #%6.6x "
-        "-tags {%lxBASE %lxOBJ %s text iemgui border}\n",
-        canvas, xpos, ypos,
-        xpos + x->x_gui.x_w+5, ypos + x->x_gui.x_h,
-        x->x_gui.x_bcol, x, x, nlet_tag);
-    sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 "
-        "-stroke #%6.6x -tags {%lxKNOB %lxOBJ %s text iemgui}\n",
-        canvas, r, ypos+2, r,
-        ypos + x->x_gui.x_h-2, x->x_gui.x_fcol, x, x, nlet_tag);
-    iemgui_label_draw_new(&x->x_gui,canvas,xpos,ypos,nlet_tag);
-    hslider_draw_io(x,glist,7);
-}
-
-static void hslider_draw_move(t_hslider *x, t_glist *glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    if (!glist_isvisible(canvas)) return;
-    int xpos=text_xpix(&x->x_gui.x_obj, glist);
-    int ypos=text_ypix(&x->x_gui.x_obj, glist);
-    int r = xpos + 3 + (x->x_val + 50)/100;
-
-    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-    iemgui_base_draw_move(&x->x_gui, canvas, nlet_tag);
-    sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n",
-        canvas, x, r, ypos+2, r, ypos + x->x_gui.x_h-2);
-    iemgui_label_draw_move(&x->x_gui,canvas,xpos,ypos);
-    iemgui_io_draw_move(&x->x_gui,canvas,nlet_tag);
-    if (x->x_gui.x_selected) hslider_draw_select(x, x->x_gui.x_glist);
-}
-
-static void hslider_draw_config(t_hslider* x,t_glist* glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    iemgui_label_draw_config(&x->x_gui,canvas);
-    iemgui_base_draw_config(&x->x_gui,canvas);
-    sys_vgui(".x%lx.c itemconfigure %lxKNOB -stroke #%6.6x\n",
-        canvas, x, x->x_gui.x_fcol);
-}
-
-static void hslider_draw_select(t_hslider* x,t_glist* glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    iemgui_base_draw_config(&x->x_gui,canvas);
-    if(x->x_gui.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))
-        {
-            scalehandle_draw_select2(&x->x_gui,glist,
-                x->x_gui.x_w+5-1,x->x_gui.x_h-1);
-        }
-    }
-    else
-    {
-        scalehandle_draw_erase2(&x->x_gui,glist);
-    }
-    iemgui_label_draw_select(&x->x_gui,canvas);
-    iemgui_tag_selected(&x->x_gui,canvas);
-}
-
-void hslider_check_minmax(t_hslider *x, double min, double max);
-void hslider_check_width(t_hslider *x, int w);
-
-static void hslider__clickhook(t_scalehandle *sh, t_floatarg f,
-    t_floatarg xxx, t_floatarg yyy)
-{
-    t_hslider *x = (t_hslider *)(sh->h_master);
-    int newstate = (int)f;
-    if (sh->h_dragon && newstate == 0 && sh->h_scale)
-    {
-        canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
-        if (sh->h_dragx || sh->h_dragy)
-        {
-            double width_change_ratio = (double)(x->x_gui.x_w +
-                sh->h_dragx)/(double)x->x_gui.x_w;
-            x->x_val = x->x_val * width_change_ratio;
-            hslider_check_width(x, x->x_gui.x_w + sh->h_dragx);
-            x->x_gui.x_h += sh->h_dragy;
-            hslider_check_minmax(x, x->x_min, x->x_max);
-            canvas_dirty(x->x_gui.x_glist, 1);
-        }
-        if (glist_isvisible(x->x_gui.x_glist))
-        {
-            hslider_draw_move(x, x->x_gui.x_glist);
-            scalehandle_unclick_scale(sh);
-        }
-    }
-    else if (!sh->h_dragon && newstate && sh->h_scale)
-    {
-        scalehandle_click_scale(sh);
-    }
-    else if (sh->h_dragon && newstate == 0 && !sh->h_scale)
-    {
-        scalehandle_unclick_label(sh);
-    }
-    else if (!sh->h_dragon && newstate && !sh->h_scale)
-    {
-        scalehandle_click_label(sh);
-    }
-    sh->h_dragon = newstate;
-}
-
-static void hslider__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2)
-{
-    if (sh->h_dragon && sh->h_scale)
-    {
-        t_hslider *x = (t_hslider *)(sh->h_master);
-        int dx = (int)f1, dy = (int)f2;
-        dx = maxi(dx, IEM_SL_MINSIZE-x->x_gui.x_w);
-        dy = maxi(dy,IEM_GUI_MINSIZE-x->x_gui.x_h);
-        sh->h_dragx = dx;
-        sh->h_dragy = dy;
-        scalehandle_drag_scale(sh);
-
-        int properties = gfxstub_haveproperties((void *)x);
-        if (properties)
-        {
-            int new_w = x->x_gui.x_w + sh->h_dragx;
-            int new_h = x->x_gui.x_h + sh->h_dragy;
-            properties_set_field_int(properties,"dim.w_ent",new_w);
-            properties_set_field_int(properties,"dim.h_ent",new_h);
-        }
-    }
-    scalehandle_dragon_label(sh,f1,f2);
-}
-
-
-void hslider_draw(t_hslider *x, t_glist *glist, int mode)
-{
-    if(mode == IEM_GUI_DRAW_MODE_UPDATE)
-        sys_queuegui(x, glist, hslider_draw_update);
-    else if(mode == IEM_GUI_DRAW_MODE_MOVE)
-        hslider_draw_move(x, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_NEW)
-    {
-        hslider_draw_new(x, glist);
-        sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
-    }
-    else if(mode == IEM_GUI_DRAW_MODE_SELECT)
-        hslider_draw_select(x, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_ERASE)
-        iemgui_draw_erase(&x->x_gui, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_CONFIG)
-        hslider_draw_config(x, glist);
-    else if(mode >= IEM_GUI_DRAW_MODE_IO)
-        hslider_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO);
-}
-
-/* ------------------------ hsl widgetbehaviour----------------------------- */
-
-static void hslider_getrect(t_gobj *z, t_glist *glist,
-                            int *xp1, int *yp1, int *xp2, int *yp2)
-{
-    t_hslider* x = (t_hslider*)z;
-
-    *xp1 = text_xpix(&x->x_gui.x_obj, glist);
-    *yp1 = text_ypix(&x->x_gui.x_obj, glist);
-    *xp2 = *xp1 + x->x_gui.x_w + 5;
-    *yp2 = *yp1 + x->x_gui.x_h;
-
-    iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
-}
-
-static void hslider_save(t_gobj *z, t_binbuf *b)
-{
-    t_hslider *x = (t_hslider *)z;
-    int bflcol[3];
-    t_symbol *srl[3];
-
-    iemgui_save(&x->x_gui, srl, bflcol);
-    binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"),
-                (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
-                gensym("hsl"), x->x_gui.x_w, x->x_gui.x_h,
-                (t_float)x->x_min, (t_float)x->x_max,
-                x->x_lin0_log1, iem_symargstoint(&x->x_gui),
-                srl[0], srl[1], srl[2],
-                x->x_gui.x_ldx, x->x_gui.x_ldy,
-                iem_fstyletoint(&x->x_gui), x->x_gui.x_fontsize,
-                bflcol[0], bflcol[1], bflcol[2],
-                x->x_val, x->x_steady);
-    binbuf_addv(b, ";");
-}
-
-void hslider_check_width(t_hslider *x, int w)
-{
-    if(w < IEM_SL_MINSIZE)
-        w = IEM_SL_MINSIZE;
-    x->x_gui.x_w = w;
-    x->x_center = (x->x_gui.x_w-1)*50;
-    if(x->x_val > (x->x_gui.x_w*100 - 100))
-    {
-        x->x_pos = x->x_gui.x_w*100 - 100;
-        x->x_val = x->x_pos;
-    }
-    if(x->x_lin0_log1)
-        x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_w - 1);
-    else
-        x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1);
-}
-
-void hslider_check_minmax(t_hslider *x, double min, double max)
-{
-    if(x->x_lin0_log1)
-    {
-        if((min == 0.0)&&(max == 0.0))
-            max = 1.0;
-        if(max > 0.0)
-        {
-            if(min <= 0.0)
-                min = 0.01*max;
-        }
-        else
-        {
-            if(min > 0.0)
-                max = 0.01*min;
-        }
-    }
-    x->x_min = min;
-    x->x_max = max;
-    if(x->x_min > x->x_max)                /* bugfix */
-        x->x_gui.x_reverse = 1;
-    else
-        x->x_gui.x_reverse = 0;
-    if(x->x_lin0_log1)
-        x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_w - 1);
-    else
-        x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1);
-}
-
-static void hslider_properties(t_gobj *z, t_glist *owner)
-{
-    t_hslider *x = (t_hslider *)z;
-    char buf[800];
-    t_symbol *srl[3];
-
-    iemgui_properties(&x->x_gui, srl);
-    sprintf(buf, "pdtk_iemgui_dialog %%s |hsl| \
-            --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \
-            -----------output-range:----------- %g left: %g right: %g \
-            %d lin log %d %d empty %d \
-            {%s} {%s} \
-            {%s} %d %d \
-            %d %d \
-            %d %d %d\n",
-            x->x_gui.x_w, IEM_SL_MINSIZE, x->x_gui.x_h, IEM_GUI_MINSIZE,
-            x->x_min, x->x_max, 0.0,/*no_schedule*/
-            x->x_lin0_log1, x->x_gui.x_loadinit, x->x_steady, -1,/*no multi, but iem-characteristic*/
-            srl[0]->s_name, srl[1]->s_name,
-            srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
-            x->x_gui.x_font_style, x->x_gui.x_fontsize,
-            0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
-    gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
-}
-
-static void hslider_set(t_hslider *x, t_floatarg f)    /* bugfix */
-{
-    double g;
-
-    if(x->x_gui.x_reverse)    /* bugfix */
-    {
-        if(f > x->x_min)
-            f = x->x_min;
-        if(f < x->x_max)
-            f = x->x_max;
-    }
-    else
-    {
-        if(f > x->x_max)
-            f = x->x_max;
-        if(f < x->x_min)
-            f = x->x_min;
-    }
-    if(x->x_lin0_log1)
-        g = log(f/x->x_min)/x->x_k;
-    else
-        g = (f - x->x_min) / x->x_k;
-    x->x_val = (int)(100.0*g + 0.49999);
-    if (x->x_pos != x->x_val)
-    {
-        x->x_pos = x->x_val;
-        x->x_gui.x_changed = 1;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-    }
-}
-
-static void hslider_bang(t_hslider *x)
-{
-    double out;
-
-    if(x->x_lin0_log1)
-        out = x->x_min*exp(x->x_k*(double)(x->x_val)*0.01);
-    else
-    {
-        if (x->x_is_last_float &&
-            x->x_last <= x->x_max && x->x_last >= x->x_min)
-            out = x->x_last;
-        else
-            out = (double)(x->x_val)*0.01*x->x_k + x->x_min;
-    }
-    if((out < 1.0e-10)&&(out > -1.0e-10))
-        out = 0.0;
-    outlet_float(x->x_gui.x_obj.ob_outlet, out);
-    if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-        pd_float(x->x_gui.x_snd->s_thing, out);
-}
-
-static void hslider_dialog(t_hslider *x, t_symbol *s, int argc, t_atom *argv)
-{
-    canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
-
-    t_symbol *srl[3];
-    int w = (int)atom_getintarg(0, argc, argv);
-    int h = (int)atom_getintarg(1, argc, argv);
-    double min = (double)atom_getfloatarg(2, argc, argv);
-    double max = (double)atom_getfloatarg(3, argc, argv);
-    int lilo = (int)atom_getintarg(4, argc, argv);
-    int steady = (int)atom_getintarg(17, argc, argv);
-    int sr_flags;
-
-    if(lilo != 0) lilo = 1;
-    x->x_lin0_log1 = lilo;
-    if(steady)
-        x->x_steady = 1;
-    else
-        x->x_steady = 0;
-    sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
-    x->x_gui.x_h = iemgui_clip_size(h);
-    int old_width = x->x_gui.x_w;
-    hslider_check_width(x, w);
-    if (x->x_gui.x_w != old_width)
-    {
-        x->x_val = x->x_val * ((double)x->x_gui.x_w/(double)old_width);
-    }
-    hslider_check_minmax(x, min, max);
-    (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
-    (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
-    //(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
-    //canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
-    iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
-
-    if (x->x_gui.x_selected) hslider_draw_select(x, x->x_gui.x_glist);
-    scrollbar_update(x->x_gui.x_glist);
-}
-
-static void hslider_motion(t_hslider *x, t_floatarg dx, t_floatarg dy)
-{
-    x->x_is_last_float = 0;
-    int old = x->x_val;
-
-    if(x->x_gui.x_finemoved)
-        x->x_pos += (int)dx;
-    else
-        x->x_pos += 100*(int)dx;
-    x->x_val = x->x_pos;
-    if(x->x_val > (100*x->x_gui.x_w - 100))
-    {
-        x->x_val = 100*x->x_gui.x_w - 100;
-        x->x_pos += 50;
-        x->x_pos -= x->x_pos%100;
-    }
-    if(x->x_val < 0)
-    {
-        x->x_val = 0;
-        x->x_pos -= 50;
-        x->x_pos -= x->x_pos%100;
-    }
-    if(old != x->x_val)
-    {
-        x->x_gui.x_changed = 1;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        hslider_bang(x);
-    }
-}
-
-static void hslider_click(t_hslider *x, t_floatarg xpos, t_floatarg ypos,
-                          t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
-{
-    if(!x->x_steady)
-        x->x_val = (int)(100.0 * (xpos -
-            text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)));
-    if(x->x_val > (100*x->x_gui.x_w - 100))
-        x->x_val = 100*x->x_gui.x_w - 100;
-    if(x->x_val < 0)
-        x->x_val = 0;
-    if (x->x_pos != x->x_val)
-    {
-        x->x_pos = x->x_val;
-        x->x_gui.x_changed = 1;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-    }
-    hslider_bang(x);
-    glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g,
-        (t_glistmotionfn)hslider_motion,
-        0, xpos, ypos);
-}
-
-static int hslider_newclick(t_gobj *z, struct _glist *glist,
-    int xpix, int ypix, int shift, int alt, int dbl, int doit)
-{
-    t_hslider* x = (t_hslider *)z;
-
-    if(doit)
-    {
-        hslider_click(x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift,
-            0, (t_floatarg)alt);
-        if(shift)
-            x->x_gui.x_finemoved = 1;
-        else
-            x->x_gui.x_finemoved = 0;
-    }
-    return (1);
-}
-
-static void hslider_size(t_hslider *x, t_symbol *s, int ac, t_atom *av)
-{
-    hslider_check_width(x, (int)atom_getintarg(0, ac, av));
-    if(ac > 1)
-        x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av));
-    iemgui_size(&x->x_gui);
-}
-
-static void hslider_range(t_hslider *x, t_symbol *s, int ac, t_atom *av)
-{
-    hslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av),
-                         (double)atom_getfloatarg(1, ac, av));
-}
-
-static void hslider_log(t_hslider *x)
-{
-    x->x_lin0_log1 = 1;
-    hslider_check_minmax(x, x->x_min, x->x_max);
-}
-
-static void hslider_lin(t_hslider *x)
-{
-    x->x_lin0_log1 = 0;
-    x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1);
-}
-
-static void hslider_init(t_hslider *x, t_floatarg f)
-{
-    x->x_gui.x_loadinit = (f==0.0)?0:1;
-}
-
-static void hslider_steady(t_hslider *x, t_floatarg f)
-{
-    x->x_steady = (f==0.0)?0:1;
-}
-
-static void hslider_float(t_hslider *x, t_floatarg f)
-{
-    double out;
-    x->x_is_last_float = 1;
-    x->x_last = f;
-
-    hslider_set(x, f);
-    if(x->x_lin0_log1)
-        out = x->x_min*exp(x->x_k*(double)(x->x_val)*0.01);
-    else
-        if (f <= x->x_max && f >= x->x_min)
-        {
-            out = f;
-            //x->x_val = f;
-        } else
-            out = (double)(x->x_val)*0.01*x->x_k + x->x_min;
-    if((out < 1.0e-10)&&(out > -1.0e-10))
-        out = 0.0;
-    if(x->x_gui.x_put_in2out)
-    {
-        outlet_float(x->x_gui.x_obj.ob_outlet, out);
-        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-            pd_float(x->x_gui.x_snd->s_thing, out);
-    }
-}
-
-static void hslider_loadbang(t_hslider *x)
-{
-    if(!sys_noloadbang && x->x_gui.x_loadinit)
-    {
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        hslider_bang(x);
-    }
-}
-
-static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
-{
-    t_hslider *x = (t_hslider *)pd_new(hslider_class);
-    int bflcol[]={-262144, -1, -1};
-    int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE;
-    int lilo=0, ldx=-2, ldy=-8, v=0, steady=1;
-    int fs=10;
-    double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
-
-    iem_inttosymargs(&x->x_gui, 0);
-    iem_inttofstyle(&x->x_gui, 0);
-
-    if(((argc == 17)||(argc == 18))&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)
-       &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3)
-       &&IS_A_FLOAT(argv,4)&&IS_A_FLOAT(argv,5)
-       &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6))
-       &&(IS_A_SYMBOL(argv,7)||IS_A_FLOAT(argv,7))
-       &&(IS_A_SYMBOL(argv,8)||IS_A_FLOAT(argv,8))
-       &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10)
-       &&IS_A_FLOAT(argv,11)&&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13)
-       &&IS_A_FLOAT(argv,14)&&IS_A_FLOAT(argv,15)&&IS_A_FLOAT(argv,16))
-    {
-        w = (int)atom_getintarg(0, argc, argv);
-        h = (int)atom_getintarg(1, argc, argv);
-        min = (double)atom_getfloatarg(2, argc, argv);
-        max = (double)atom_getfloatarg(3, argc, argv);
-        lilo = (int)atom_getintarg(4, argc, argv);
-        iem_inttosymargs(&x->x_gui, atom_getintarg(5, argc, argv));
-        iemgui_new_getnames(&x->x_gui, 6, argv);
-        ldx = (int)atom_getintarg(9, argc, argv);
-        ldy = (int)atom_getintarg(10, argc, argv);
-        iem_inttofstyle(&x->x_gui, atom_getintarg(11, argc, argv));
-        fs = (int)atom_getintarg(12, argc, argv);
-        bflcol[0] = (int)atom_getintarg(13, argc, argv);
-        bflcol[1] = (int)atom_getintarg(14, argc, argv);
-        bflcol[2] = (int)atom_getintarg(15, argc, argv);
-        v = (int)atom_getintarg(16, argc, argv);
-    }
-    else iemgui_new_getnames(&x->x_gui, 6, 0);
-    if((argc == 18)&&IS_A_FLOAT(argv,17))
-        steady = (int)atom_getintarg(17, argc, argv);
-
-    x->x_gui.x_draw = (t_iemfunptr)hslider_draw;
-
-    x->x_is_last_float = 0;
-    x->x_last = 0.0;
-
-    x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
-    if(x->x_gui.x_loadinit)
-        x->x_val = v;
-    else
-        x->x_val = 0;
-    x->x_pos = x->x_val;
-    if(lilo != 0) lilo = 1;
-    x->x_lin0_log1 = lilo;
-    if(steady != 0) steady = 1;
-    x->x_steady = steady;
-    if (x->x_gui.x_font_style<0 || x->x_gui.x_font_style>2) x->x_gui.x_font_style=0;
-    if(iemgui_has_rcv(&x->x_gui))
-        pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
-    x->x_gui.x_ldx = ldx;
-    x->x_gui.x_ldy = ldy;
-    if(fs < 4)
-        fs = 4;
-    x->x_gui.x_fontsize = fs;
-    x->x_gui.x_h = iemgui_clip_size(h);
-    hslider_check_width(x, w);
-    hslider_check_minmax(x, min, max);
-    iemgui_all_colfromload(&x->x_gui, bflcol);
-    x->x_thick = 0;
-    iemgui_verify_snd_ne_rcv(&x->x_gui);
-    outlet_new(&x->x_gui.x_obj, &s_float);
-
-    x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_iemgui *)x,1);
-    x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_iemgui *)x,0);
-    x->x_gui.x_obj.te_iemgui = 1;
-    x->x_gui.x_changed = 0;
-
-    return (x);
-}
-
-static void hslider_free(t_hslider *x)
-{
-    if(iemgui_has_rcv(&x->x_gui))
-        pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
-    gfxstub_deleteforkey(x);
-
-    if (x->x_gui. x_handle) scalehandle_free(x->x_gui. x_handle);
-    if (x->x_gui.x_lhandle) scalehandle_free(x->x_gui.x_lhandle);
-}
-
-void g_hslider_setup(void)
-{
-    hslider_class = class_new(gensym("hsl"), (t_newmethod)hslider_new,
-        (t_method)hslider_free, sizeof(t_hslider), 0, A_GIMME, 0);
-    class_addcreator((t_newmethod)hslider_new, gensym("hslider"), A_GIMME, 0);
-    class_addbang(hslider_class,hslider_bang);
-    class_addfloat(hslider_class,hslider_float);
-    class_addmethod(hslider_class, (t_method)hslider_click, gensym("click"),
-                    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
-    class_addmethod(hslider_class, (t_method)hslider_motion, gensym("motion"),
-                    A_FLOAT, A_FLOAT, 0);
-    class_addmethod(hslider_class, (t_method)hslider_dialog,
-        gensym("dialog"), A_GIMME, 0);
-    class_addmethod(hslider_class, (t_method)hslider_loadbang,
-        gensym("loadbang"), 0);
-    class_addmethod(hslider_class, (t_method)hslider_set,
-        gensym("set"), A_FLOAT, 0);
-    class_addmethod(hslider_class, (t_method)hslider_size,
-        gensym("size"), A_GIMME, 0);
-    iemgui_class_addmethods(hslider_class);
-    class_addmethod(hslider_class, (t_method)hslider_range,
-        gensym("range"), A_GIMME, 0);
-    class_addmethod(hslider_class, (t_method)hslider_log, gensym("log"), 0);
-    class_addmethod(hslider_class, (t_method)hslider_lin, gensym("lin"), 0);
-    class_addmethod(hslider_class, (t_method)hslider_init,
-        gensym("init"), A_FLOAT, 0);
-    class_addmethod(hslider_class, (t_method)hslider_steady,
-        gensym("steady"), A_FLOAT, 0);
- 
-    scalehandle_class = class_new(gensym("_scalehandle"), 0, 0,
-                  sizeof(t_scalehandle), CLASS_PD, 0);
-    class_addmethod(scalehandle_class, (t_method)hslider__clickhook,
-            gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
-    class_addmethod(scalehandle_class, (t_method)hslider__motionhook,
-            gensym("_motion"), A_FLOAT, A_FLOAT, 0);
-
-    wb_init(&hslider_widgetbehavior,hslider_getrect,hslider_newclick);
-    class_setwidget(hslider_class, &hslider_widgetbehavior);
-    class_sethelpsymbol(hslider_class, gensym("hslider"));
-    class_setsavefn(hslider_class, hslider_save);
-    class_setpropertiesfn(hslider_class, hslider_properties);
-}
diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c
index 69bfe525763a7c06ae1aaddc219546ad1c435405..112986152f0efe76bd45d6127f13049eb3283f7b 100644
--- a/pd/src/g_mycanvas.c
+++ b/pd/src/g_mycanvas.c
@@ -5,26 +5,15 @@
 /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
 /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
 
-#include "config.h"
-
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <ctype.h>
 #include "m_pd.h"
 #include "g_canvas.h"
-#include "t_tk.h"
 #include "g_all_guis.h"
 #include <math.h>
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_IO_H
-#include <io.h>
-#endif
-
+static t_class *scalehandle_class;
 extern int gfxstub_haveproperties(void *key);
 void my_canvas_draw_select(t_my_canvas* x, t_glist* glist);
 
diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c
index 6c46a6845de14ea65ef44ce0995ef06b1f07d7ed..3123e977f1c3de1ac25d9a4dd2b42d2537e1c5a1 100644
--- a/pd/src/g_numbox.c
+++ b/pd/src/g_numbox.c
@@ -4,26 +4,15 @@
 
 /* my_numbox.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
 
-#include "config.h"
-
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <ctype.h>
 #include "m_pd.h"
 #include "g_canvas.h"
-#include "t_tk.h"
 #include "g_all_guis.h"
 #include <math.h>
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_IO_H
-#include <io.h>
-#endif
-
+static t_class *scalehandle_class;
 extern int gfxstub_haveproperties(void *key);
 static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist);
 
diff --git a/pd/src/g_radio.c b/pd/src/g_radio.c
new file mode 100644
index 0000000000000000000000000000000000000000..0ad200a706b52af94b3757d882df9ae4811097c9
--- /dev/null
+++ b/pd/src/g_radio.c
@@ -0,0 +1,890 @@
+// g_radio.c
+// written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 as hdial/vdial.
+// thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja.
+// Copyright (c) 2014 by Mathieu Bouchard. (rewrite).
+// For information on usage and redistribution, and for a DISCLAIMER OF ALL
+// WARRANTIES, see the file, "LICENSE.txt", in this distribution.
+
+// name change to hradio/vradio by MSP (it's a radio button really) and
+// changed to put out a "float" as in sliders, toggles, etc.
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "m_pd.h"
+#include "g_canvas.h"
+#include "g_all_guis.h"
+#include <math.h>
+
+static t_class *hscalehandle_class;
+static t_class *vscalehandle_class;
+extern int gfxstub_haveproperties(void *key);
+void hradio_draw_select(t_radio *x, t_glist *glist);
+void vradio_draw_select(t_radio *x, t_glist *glist);
+t_widgetbehavior hradio_widgetbehavior;
+t_widgetbehavior vradio_widgetbehavior;
+t_class *hradio_class, *hradio_old_class;
+t_class *vradio_class, *vradio_old_class;
+
+void radio_draw_update(t_gobj *client, t_glist *glist)
+{
+    t_radio *x = (t_radio *)client;
+    if(!glist_isvisible(glist)) return;
+    t_canvas *canvas=glist_getcanvas(glist);
+    sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n",
+        canvas, x, x->x_drawn, x->x_gui.x_bcol, x->x_gui.x_bcol);
+    sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n",
+        canvas, x, x->x_on,    x->x_gui.x_fcol, x->x_gui.x_fcol);
+    x->x_drawn = x->x_on;
+}
+
+void radio_draw_io(t_radio *x, t_glist *glist, int old_snd_rcv_flags)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    iemgui_io_draw(&x->x_gui,canvas,old_snd_rcv_flags);
+}
+void hradio_draw_new(t_radio *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
+    int x1=text_xpix(&x->x_gui.x_obj, glist), xi=x1;
+    int y1=text_ypix(&x->x_gui.x_obj, glist); 
+    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
+
+    iemgui_base_draw_new(&x->x_gui, canvas, nlet_tag);
+    scalehandle_draw_new(x->x_gui. x_handle,canvas);
+    scalehandle_draw_new(x->x_gui.x_lhandle,canvas);
+
+    for(i=0; i<n; i++)
+    {
+        if (i) sys_vgui(".x%lx.c create pline %d %d %d %d "
+            "-stroke $pd_colors(iemgui_border) "
+            "-tags {%lxBASE%d %lxBASEL %lxOBJ %s text iemgui border}\n",
+            canvas, xi, y1, xi, y1+d, x, i, x, x, nlet_tag);
+        sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x "
+            "-stroke #%6.6x -tags {%lxBUT%d %lxOBJ %s text iemgui}\n",
+            canvas, xi+s, y1+s, xi+d-s, y1+d-s,
+            (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
+            (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
+            x, i, x, nlet_tag);
+        xi += d;
+        x->x_drawn = x->x_on;
+    }
+    iemgui_label_draw_new(&x->x_gui,canvas,x1,y1,nlet_tag);
+    radio_draw_io(x,glist,7);
+}
+void vradio_draw_new(t_radio *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
+    int x1=text_xpix(&x->x_gui.x_obj, glist);
+    int y1=text_ypix(&x->x_gui.x_obj, glist), yi=y1;
+    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
+
+    iemgui_base_draw_new(&x->x_gui, canvas, nlet_tag);
+    scalehandle_draw_new(x->x_gui. x_handle,canvas);
+    scalehandle_draw_new(x->x_gui.x_lhandle,canvas);
+
+    for(i=0; i<n; i++)
+    {
+        if (i) sys_vgui(".x%lx.c create pline %d %d %d %d "
+            "-stroke $pd_colors(iemgui_border) "
+            "-tags {%lxBASE%d %lxBASEL %lxOBJ %s text iemgui border}\n",
+            canvas, x1, yi, x1+d, yi, x, i, x, x, nlet_tag);
+        sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x "
+            "-stroke #%6.6x -tags {%lxBUT%d %lxOBJ %s text iemgui}\n",
+            canvas, x1+s, yi+s, x1+d-s, yi+d-s,
+            (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
+            (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
+            x, i, x, nlet_tag);
+        yi += d;
+        x->x_drawn = x->x_on;
+    }
+    iemgui_label_draw_new(&x->x_gui,canvas,x1,y1,nlet_tag);
+    radio_draw_io(x,glist,7);
+}
+
+void hradio_draw_move(t_radio *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    if (!glist_isvisible(canvas)) return;
+    int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
+    int x1=text_xpix(&x->x_gui.x_obj, glist), xi=x1;
+    int y1=text_ypix(&x->x_gui.x_obj, glist); 
+    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
+    iemgui_base_draw_move(&x->x_gui, canvas, nlet_tag);
+    for(i=0; i<n; i++)
+    {
+        sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n",
+            canvas, x, i, xi, y1, xi, y1+d);
+        sys_vgui(".x%lx.c coords %lxBUT%d %d %d %d %d\n",
+            canvas, x, i, xi+s, y1+s, xi+d-s, y1+d-s);
+        xi += d;
+    }
+    iemgui_label_draw_move(&x->x_gui,canvas,x1,y1);
+    iemgui_io_draw_move(&x->x_gui,canvas,nlet_tag);
+    if (x->x_gui.x_selected) hradio_draw_select(x, x->x_gui.x_glist);
+}
+void vradio_draw_move(t_radio *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    if (!glist_isvisible(canvas)) return;
+    int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
+    int x1=text_xpix(&x->x_gui.x_obj, glist);
+    int y1=text_ypix(&x->x_gui.x_obj, glist), yi=y1;
+    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
+    iemgui_base_draw_move(&x->x_gui, canvas, nlet_tag);
+    for(i=0; i<n; i++)
+    {
+        sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n",
+            canvas, x, i, x1, yi, x1+d, yi);
+        sys_vgui(".x%lx.c coords %lxBUT%d %d %d %d %d\n",
+            canvas, x, i, x1+s, yi+s, x1+d-s, yi+d-s);
+        yi += d;
+    }
+    iemgui_label_draw_move(&x->x_gui,canvas,x1,y1);
+    iemgui_io_draw_move(&x->x_gui,canvas,nlet_tag);
+    if (x->x_gui.x_selected) vradio_draw_select(x, x->x_gui.x_glist);
+}
+
+void radio_draw_config(t_radio *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    int n=x->x_number, i;
+    iemgui_label_draw_config(&x->x_gui,canvas);
+    iemgui_base_draw_config(&x->x_gui,canvas);
+    for(i=0; i<n; i++)
+    {
+        sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n",
+            canvas, x, i,
+            (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol,
+            (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol);
+    }
+}
+
+void hradio_draw_select(t_radio *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    iemgui_base_draw_config(&x->x_gui,canvas);
+    if(x->x_gui.x_selected)
+    {
+        if (x->x_gui.x_glist == glist_getcanvas(glist))
+            scalehandle_draw_select2(&x->x_gui,glist,
+                x->x_gui.x_w*x->x_number-1,x->x_gui.x_h-1);
+    }
+    else
+    {
+        scalehandle_draw_erase2(&x->x_gui,glist);
+    }
+    iemgui_label_draw_select(&x->x_gui,canvas);
+    iemgui_tag_selected(&x->x_gui,canvas);
+}
+void vradio_draw_select(t_radio *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    iemgui_base_draw_config(&x->x_gui,canvas);
+    if(x->x_gui.x_selected)
+    {
+        if (x->x_gui.x_glist == glist_getcanvas(glist))
+            scalehandle_draw_select2(&x->x_gui,glist,
+                x->x_gui.x_w-1,x->x_gui.x_h*x->x_number-1);
+    }
+    else
+    {
+        scalehandle_draw_erase2(&x->x_gui,glist);
+    }
+    iemgui_label_draw_select(&x->x_gui,canvas);
+    iemgui_tag_selected(&x->x_gui,canvas);
+}
+
+static void hradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx,
+    t_floatarg yyy)
+{
+    t_radio *x = (t_radio *)(sh->h_master);
+    int newstate = (int)f;
+    if (sh->h_dragon && newstate == 0 && sh->h_scale)
+    {
+        canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
+        if (sh->h_dragx || sh->h_dragy)
+        {
+            x->x_gui.x_w += sh->h_dragy;
+            x->x_gui.x_h += sh->h_dragy;
+            canvas_dirty(x->x_gui.x_glist, 1);
+        }
+        if (glist_isvisible(x->x_gui.x_glist))
+        {
+            hradio_draw_move(x, x->x_gui.x_glist);
+            scalehandle_unclick_scale(sh);
+        }
+    }
+    else if (!sh->h_dragon && newstate && sh->h_scale)
+        scalehandle_click_scale(sh);
+    else if (sh->h_dragon && newstate == 0 && !sh->h_scale)
+        scalehandle_unclick_label(sh);
+    else if (!sh->h_dragon && newstate && !sh->h_scale)
+        scalehandle_click_label(sh);
+    sh->h_dragon = newstate;
+}
+static void vradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx,
+    t_floatarg yyy)
+{
+    t_radio *x = (t_radio *)(sh->h_master);
+    int newstate = (int)f;
+    if (sh->h_dragon && newstate == 0 && sh->h_scale)
+    {
+        canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
+        if (sh->h_dragx || sh->h_dragy)
+        {
+            x->x_gui.x_w += sh->h_dragx;
+            x->x_gui.x_h += sh->h_dragx;
+            canvas_dirty(x->x_gui.x_glist, 1);
+        }
+        if (glist_isvisible(x->x_gui.x_glist))
+        {
+            vradio_draw_move(x, x->x_gui.x_glist);
+            scalehandle_unclick_scale(sh);
+        }
+    }
+    else if (!sh->h_dragon && newstate && sh->h_scale)
+        scalehandle_click_scale(sh);
+    else if (sh->h_dragon && newstate == 0 && !sh->h_scale)
+        scalehandle_unclick_label(sh);
+    else if (!sh->h_dragon && newstate && !sh->h_scale)
+        scalehandle_click_label(sh);
+    sh->h_dragon = newstate;
+}
+
+static void hradio__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2)
+{
+    if (sh->h_dragon && sh->h_scale)
+    {
+        t_radio *x = (t_radio *)(sh->h_master);
+        int dx = (int)f1, dy = (int)f2;
+        dx = maxi(dx,(IEM_GUI_MINSIZE-x->x_gui.x_w)*x->x_number);
+        dy = dx/x->x_number;
+        sh->h_dragx = dx;
+        sh->h_dragy = dy;
+        scalehandle_drag_scale(sh);
+
+        int properties = gfxstub_haveproperties((void *)x);
+        if (properties)
+        {
+            int new_w = x->x_gui.x_w + sh->h_dragx;
+            properties_set_field_int(properties,"dim.w_ent",new_w);
+        }
+    }
+    scalehandle_dragon_label(sh,f1,f2);
+}
+static void vradio__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2)
+{
+    if (sh->h_dragon && sh->h_scale)
+    {
+        t_radio *x = (t_radio *)(sh->h_master);
+        int dx = (int)f1, dy = (int)f2;
+        dy = maxi(dy,(IEM_GUI_MINSIZE-x->x_gui.x_h)*x->x_number);
+        dx = dy/x->x_number;
+        sh->h_dragx = dx;
+        sh->h_dragy = dy;
+        scalehandle_drag_scale(sh);
+
+        int properties = gfxstub_haveproperties((void *)x);
+        if (properties)
+        {
+            int new_w = x->x_gui.x_h + sh->h_dragy;
+            properties_set_field_int(properties,"dim.w_ent",new_w);
+        }
+    }
+    scalehandle_dragon_label(sh,f1,f2);
+}
+
+void hradio_draw(t_radio *x, t_glist *glist, int mode)
+{
+    if(mode == IEM_GUI_DRAW_MODE_UPDATE)        sys_queuegui(x, glist, radio_draw_update);
+    else if(mode == IEM_GUI_DRAW_MODE_MOVE)     hradio_draw_move(x, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_NEW)     {hradio_draw_new(x, glist); sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));}
+    else if(mode == IEM_GUI_DRAW_MODE_SELECT)   hradio_draw_select(x, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_ERASE)    iemgui_draw_erase(&x->x_gui, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_CONFIG)   radio_draw_config(x, glist);
+    else if(mode >= IEM_GUI_DRAW_MODE_IO)       radio_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO);
+}
+void vradio_draw(t_radio *x, t_glist *glist, int mode)
+{
+    if(mode == IEM_GUI_DRAW_MODE_UPDATE)        sys_queuegui(x, glist, radio_draw_update);
+    else if(mode == IEM_GUI_DRAW_MODE_MOVE)     vradio_draw_move(x, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_NEW)     {vradio_draw_new(x, glist); sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));}
+    else if(mode == IEM_GUI_DRAW_MODE_SELECT)   vradio_draw_select(x, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_ERASE)    iemgui_draw_erase(&x->x_gui, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_CONFIG)   radio_draw_config(x, glist);
+    else if(mode >= IEM_GUI_DRAW_MODE_IO)       radio_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO);
+}
+
+static void hradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1,
+    int *xp2, int *yp2)
+{
+    t_radio *x = (t_radio *)z;
+
+    *xp1 = text_xpix(&x->x_gui.x_obj, glist);
+    *yp1 = text_ypix(&x->x_gui.x_obj, glist);
+    *xp2 = *xp1 + x->x_gui.x_w*x->x_number;
+    *yp2 = *yp1 + x->x_gui.x_h;
+
+    iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
+}
+
+static void vradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1,
+    int *xp2, int *yp2)
+{
+    t_radio *x = (t_radio *)z;
+
+    *xp1 = text_xpix(&x->x_gui.x_obj, glist);
+    *yp1 = text_ypix(&x->x_gui.x_obj, glist);
+    *xp2 = *xp1 + x->x_gui.x_w;
+    *yp2 = *yp1 + x->x_gui.x_h*x->x_number;
+
+    iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
+}
+
+static void hradio_save(t_gobj *z, t_binbuf *b)
+{
+    t_radio *x = (t_radio *)z;
+    int bflcol[3];
+    t_symbol *srl[3];
+
+    iemgui_save(&x->x_gui, srl, bflcol);
+    binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"),
+                (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
+                (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ?
+                    gensym("hdl") : gensym("hradio")),
+                x->x_gui.x_w,
+                x->x_change, iem_symargstoint(&x->x_gui), x->x_number,
+                srl[0], srl[1], srl[2],
+                x->x_gui.x_ldx, x->x_gui.x_ldy,
+                iem_fstyletoint(&x->x_gui), x->x_gui.x_fontsize,
+                bflcol[0], bflcol[1], bflcol[2], x->x_on);
+    binbuf_addv(b, ";");
+}
+
+static void vradio_save(t_gobj *z, t_binbuf *b)
+{
+    t_radio *x = (t_radio *)z;
+    int bflcol[3];
+    t_symbol *srl[3];
+
+    iemgui_save(&x->x_gui, srl, bflcol);
+    binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"),
+                (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
+                (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class ?
+                    gensym("vdl") : gensym("vradio")),
+                x->x_gui.x_w,
+                x->x_change, iem_symargstoint(&x->x_gui), x->x_number,
+                srl[0], srl[1], srl[2],
+                x->x_gui.x_ldx, x->x_gui.x_ldy,
+                iem_fstyletoint(&x->x_gui), x->x_gui.x_fontsize,
+                bflcol[0], bflcol[1], bflcol[2], x->x_on);
+    binbuf_addv(b, ";");
+}
+static void hradio_properties(t_gobj *z, t_glist *owner)
+{
+    t_radio *x = (t_radio *)z;
+    char buf[800];
+    t_symbol *srl[3];
+    int hchange=-1;
+
+    iemgui_properties(&x->x_gui, srl);
+    if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class)
+        hchange = x->x_change;
+    sprintf(buf, "pdtk_iemgui_dialog %%s |hradio| \
+        ----------dimensions(pix):----------- %d %d size: 0 0 empty \
+        empty 0.0 empty 0.0 empty %d %d new-only new&old %d %d number: %d \
+        {%s} {%s} {%s} %d %d %d %d %d %d %d\n",
+        x->x_gui.x_w, IEM_GUI_MINSIZE, 0,/*no_schedule*/
+        hchange, x->x_gui.x_loadinit, -1, x->x_number,
+        srl[0]->s_name, srl[1]->s_name,
+        srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
+        x->x_gui.x_font_style, x->x_gui.x_fontsize,
+        0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol,
+        0xffffff & x->x_gui.x_lcol);
+    gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
+}
+static void vradio_properties(t_gobj *z, t_glist *owner)
+{
+    t_radio *x = (t_radio *)z;
+    char buf[800];
+    t_symbol *srl[3];
+    int hchange=-1;
+
+    iemgui_properties(&x->x_gui, srl);
+    if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class)
+        hchange = x->x_change;
+    sprintf(buf, "pdtk_iemgui_dialog %%s |vradio| \
+        ----------dimensions(pix):----------- %d %d size: 0 0 empty \
+        empty 0.0 empty 0.0 empty %d %d new-only new&old %d %d number: %d \
+        {%s} {%s} {%s} %d %d %d %d %d %d %d\n",
+        x->x_gui.x_w, IEM_GUI_MINSIZE, 0,/*no_schedule*/
+        hchange, x->x_gui.x_loadinit, -1, x->x_number,
+        srl[0]->s_name, srl[1]->s_name,
+        srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
+        x->x_gui.x_font_style, x->x_gui.x_fontsize,
+        0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol,
+        0xffffff & x->x_gui.x_lcol);
+    gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
+}
+
+static void hradio_dialog(t_radio *x, t_symbol *s, int argc, t_atom *argv)
+{
+    canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
+
+    t_symbol *srl[3];
+    int a = (int)atom_getintarg(0, argc, argv);
+    int chg = (int)atom_getintarg(4, argc, argv);
+    int num = (int)atom_getintarg(6, argc, argv);
+    int sr_flags;
+
+    if(chg != 0) chg = 1;
+    x->x_change = chg;
+    sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
+    x->x_gui.x_w = iemgui_clip_size(a);
+    x->x_gui.x_h = x->x_gui.x_w;
+    if(x->x_number != num)
+    {
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
+        x->x_number = num;
+        if(x->x_on >= x->x_number)
+        {
+            x->x_on = x->x_number - 1;
+            x->x_on_old = x->x_on;
+        }
+        //x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
+        iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_NEW);
+    }
+    else
+    {
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
+        //x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
+        //canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
+        iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
+    }
+    if (x->x_gui.x_selected) hradio_draw_select(x, x->x_gui.x_glist);
+    scrollbar_update(x->x_gui.x_glist);
+}
+static void vradio_dialog(t_radio *x, t_symbol *s, int argc, t_atom *argv)
+{
+    canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
+
+    t_symbol *srl[3];
+    int a = (int)atom_getintarg(0, argc, argv);
+    int chg = (int)atom_getintarg(4, argc, argv);
+    int num = (int)atom_getintarg(6, argc, argv);
+    int sr_flags;
+
+    if(chg != 0) chg = 1;
+    x->x_change = chg;
+    sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
+    x->x_gui.x_w = iemgui_clip_size(a);
+    x->x_gui.x_h = x->x_gui.x_w;
+    if(x->x_number != num)
+    {
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
+        x->x_number = num;
+        if(x->x_on >= x->x_number)
+        {
+            x->x_on = x->x_number - 1;
+            x->x_on_old = x->x_on;
+        }
+        //x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
+        iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_NEW);
+    }
+    else
+    {
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
+        //x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
+        //canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
+        iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
+    }
+    if (x->x_gui.x_selected) vradio_draw_select(x, x->x_gui.x_glist);
+    scrollbar_update(x->x_gui.x_glist);
+}
+
+static void radio_set(t_radio *x, t_floatarg f)
+{
+    int i=mini(maxi((int)f,0),x->x_number-1);
+    if(x->x_on != x->x_on_old)
+    {
+        int old = x->x_on_old;
+        x->x_on_old = x->x_on;
+        x->x_on = i;
+        if (x->x_on != x->x_on_old)
+            x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+        x->x_on_old = old;
+    }
+    else
+    {
+        x->x_on = i;
+        if (x->x_on != x->x_on_old)
+            x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+    }
+}
+
+static void radio_bang(t_radio *x)
+{
+    if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ||
+        pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class)
+    {
+        if((x->x_change)&&(x->x_on != x->x_on_old))
+        {
+            SETFLOAT(x->x_at, (t_float)x->x_on_old);
+            SETFLOAT(x->x_at+1, 0.0);
+            outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
+            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
+                pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
+        }
+        x->x_on_old = x->x_on;
+        SETFLOAT(x->x_at, (t_float)x->x_on);
+        SETFLOAT(x->x_at+1, 1.0);
+        outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
+        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
+            pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
+    }
+    else
+    {
+        outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
+        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
+            pd_float(x->x_gui.x_snd->s_thing, x->x_on);
+    }
+}
+
+static void radio_fout(t_radio *x, t_floatarg f)
+{
+    int i=mini(maxi((int)f,0),x->x_number-1);
+
+    if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ||
+        pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class)
+    {
+        if((x->x_change)&&(i != x->x_on_old))
+        {
+            SETFLOAT(x->x_at, (t_float)x->x_on_old);
+            SETFLOAT(x->x_at+1, 0.0);
+            outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
+            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
+                pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
+        }
+        if(x->x_on != x->x_on_old)
+            x->x_on_old = x->x_on;
+        x->x_on = i;
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+        x->x_on_old = x->x_on;
+        SETFLOAT(x->x_at, (t_float)x->x_on);
+        SETFLOAT(x->x_at+1, 1.0);
+        outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
+        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
+            pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
+    }
+    else
+    {
+        x->x_on_old = x->x_on;
+        x->x_on = i;
+        if (i != x->x_on_old)
+            x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+        outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
+        if (iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
+            pd_float(x->x_gui.x_snd->s_thing, x->x_on);
+    }
+}
+
+static void radio_float(t_radio *x, t_floatarg f)
+{
+    int i=mini(maxi((int)f,0),x->x_number-1);
+
+    if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ||
+        pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class)
+    {
+        if((x->x_change)&&(i != x->x_on_old))
+        {
+            if(x->x_gui.x_put_in2out)
+            {
+                SETFLOAT(x->x_at, (t_float)x->x_on_old);
+                SETFLOAT(x->x_at+1, 0.0);
+                outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
+                if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
+                    pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
+            }
+        }
+        if(x->x_on != x->x_on_old)
+            x->x_on_old = x->x_on;
+        x->x_on = i;
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+        x->x_on_old = x->x_on;
+        if(x->x_gui.x_put_in2out)
+        {
+            SETFLOAT(x->x_at, (t_float)x->x_on);
+            SETFLOAT(x->x_at+1, 1.0);
+            outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
+            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
+                pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
+        }
+    }
+    else
+    {
+        x->x_on_old = x->x_on;
+        x->x_on = i;
+        if (i != x->x_on_old)
+            x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+        if (x->x_gui.x_put_in2out)
+        {
+            outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
+            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
+                pd_float(x->x_gui.x_snd->s_thing, x->x_on);
+        }
+    }
+}
+
+static void hradio_click(t_radio *x, t_floatarg xpos, t_floatarg ypos,
+    t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
+{
+    int xx = (int)xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
+    radio_fout(x, (t_float)(xx / x->x_gui.x_w));
+}
+
+static void vradio_click(t_radio *x, t_floatarg xpos, t_floatarg ypos,
+    t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
+{
+    int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
+    radio_fout(x, (t_float)(yy / x->x_gui.x_h));
+}
+
+static int hradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix,
+    int shift, int alt, int dbl, int doit)
+{
+    if(doit)
+        hradio_click((t_radio *)z, (t_floatarg)xpix, (t_floatarg)ypix,
+            (t_floatarg)shift, 0, (t_floatarg)alt);
+    return (1);
+}
+static int vradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix,
+    int shift, int alt, int dbl, int doit)
+{
+    if(doit)
+        vradio_click((t_radio *)z, (t_floatarg)xpix, (t_floatarg)ypix,
+            (t_floatarg)shift, 0, (t_floatarg)alt);
+    return (1);
+}
+
+static void radio_loadbang(t_radio *x)
+{
+    if(!sys_noloadbang && x->x_gui.x_loadinit)
+        radio_bang(x);
+}
+
+static void radio_number(t_radio *x, t_floatarg num)
+{
+    int n=mini(maxi((int)num,1),IEM_RADIO_MAX);
+    if(n != x->x_number)
+    {
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
+        x->x_number = n;
+        if(x->x_on >= x->x_number)
+            x->x_on = x->x_number - 1;
+        x->x_on_old = x->x_on;
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
+    }
+}
+
+static void radio_size(t_radio *x, t_symbol *s, int ac, t_atom *av)
+{
+    x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
+    x->x_gui.x_h = x->x_gui.x_w;
+    iemgui_size(&x->x_gui);
+}
+
+static void radio_init(t_radio *x, t_floatarg f)
+{
+    x->x_gui.x_loadinit = (f==0.0)?0:1;
+}
+
+static void radio_double_change(t_radio *x) {x->x_change = 1;}
+static void radio_single_change(t_radio *x) {x->x_change = 0;}
+
+static void *radio_new(t_symbol *s, int argc, t_atom *argv)
+{
+    t_radio *x = (t_radio *)pd_new(
+        s==gensym("hdl") ? hradio_old_class :
+        s==gensym("vdl") ? vradio_old_class :
+        s==gensym("vradio") ? vradio_class : hradio_class);
+    x->x_orient = s==gensym("vdl") || s==gensym("vradio");
+    int bflcol[]={-262144, -1, -1};
+    int a=IEM_GUI_DEFAULTSIZE, on=0, ldx=0, ldy=-8, chg=1, num=8, fs=10;
+    iem_inttosymargs(&x->x_gui, 0);
+    iem_inttofstyle(&x->x_gui, 0);
+
+    if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2)
+       &&IS_A_FLOAT(argv,3)
+       &&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4))
+       &&(IS_A_SYMBOL(argv,5)||IS_A_FLOAT(argv,5))
+       &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6))
+       &&IS_A_FLOAT(argv,7)&&IS_A_FLOAT(argv,8)
+       &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10)&&IS_A_FLOAT(argv,11)
+       &&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13)&&IS_A_FLOAT(argv,14))
+    {
+        a = (int)atom_getintarg(0, argc, argv);
+        chg = (int)atom_getintarg(1, argc, argv);
+        iem_inttosymargs(&x->x_gui, atom_getintarg(2, argc, argv));
+        num = (int)atom_getintarg(3, argc, argv);
+        iemgui_new_getnames(&x->x_gui, 4, argv);
+        ldx = (int)atom_getintarg(7, argc, argv);
+        ldy = (int)atom_getintarg(8, argc, argv);
+        iem_inttofstyle(&x->x_gui, atom_getintarg(9, argc, argv));
+        fs = (int)atom_getintarg(10, argc, argv);
+        bflcol[0] = (int)atom_getintarg(11, argc, argv);
+        bflcol[1] = (int)atom_getintarg(12, argc, argv);
+        bflcol[2] = (int)atom_getintarg(13, argc, argv);
+        on = (int)atom_getintarg(14, argc, argv);
+    }
+    else iemgui_new_getnames(&x->x_gui, 4, 0);
+    x->x_gui.x_draw = x->x_orient ? (t_iemfunptr)vradio_draw : (t_iemfunptr)hradio_draw;
+    x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
+    if (x->x_gui.x_font_style<0 || x->x_gui.x_font_style>2) x->x_gui.x_font_style=0;
+    if(num < 1)
+        num = 1;
+    if(num > IEM_RADIO_MAX)
+        num = IEM_RADIO_MAX;
+    x->x_number = num;
+    if(on < 0)
+        on = 0;
+    if(on >= x->x_number)
+        on = x->x_number - 1;
+    if(x->x_gui.x_loadinit)
+        x->x_on = on;
+    else
+        x->x_on = 0;
+    x->x_on_old = x->x_on;
+    x->x_change = (chg==0)?0:1;
+    if (iemgui_has_rcv(&x->x_gui))
+        pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
+    x->x_gui.x_ldx = ldx;
+    x->x_gui.x_ldy = ldy;
+    if(fs < 4)
+        fs = 4;
+    x->x_gui.x_fontsize = fs;
+    x->x_gui.x_w = iemgui_clip_size(a);
+    x->x_gui.x_h = x->x_gui.x_w;
+    iemgui_verify_snd_ne_rcv(&x->x_gui);
+    iemgui_all_colfromload(&x->x_gui, bflcol);
+    outlet_new(&x->x_gui.x_obj, &s_list);
+
+    t_class *sc = x->x_orient ? vscalehandle_class : hscalehandle_class;
+    x->x_gui. x_handle = scalehandle_new(sc,(t_iemgui *)x,1);
+    x->x_gui.x_lhandle = scalehandle_new(sc,(t_iemgui *)x,0);
+    x->x_gui.x_obj.te_iemgui = 1;
+
+    return (x);
+}
+
+static void radio_free(t_radio *x)
+{
+    if(iemgui_has_rcv(&x->x_gui))
+        pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
+    gfxstub_deleteforkey(x);
+
+    if (x->x_gui. x_handle) scalehandle_free(x->x_gui. x_handle);
+    if (x->x_gui.x_lhandle) scalehandle_free(x->x_gui.x_lhandle);
+}
+
+void radio_addmethods(t_class *c)
+{
+    class_addmethod(c, (t_method)radio_loadbang,  gensym("loadbang"), 0);
+    class_addmethod(c, (t_method)radio_set,       gensym("set"), A_FLOAT, 0);
+    class_addmethod(c, (t_method)radio_size,      gensym("size"), A_GIMME, 0);
+    class_addmethod(c, (t_method)radio_init,      gensym("init"), A_FLOAT, 0);
+    class_addmethod(c, (t_method)radio_number,  gensym("number"), A_FLOAT, 0);
+    class_addmethod(c, (t_method)radio_single_change,
+        gensym("single_change"), 0);
+    class_addmethod(c, (t_method)radio_double_change,
+        gensym("double_change"), 0);
+}
+
+void g_hradio_setup(void)
+{
+    hradio_class = class_new(gensym("hradio"), (t_newmethod)radio_new,
+        (t_method)radio_free, sizeof(t_radio), 0, A_GIMME, 0);
+    class_addbang(hradio_class, radio_bang);
+    class_addfloat(hradio_class, radio_float);
+    class_addmethod(hradio_class, (t_method)hradio_click, gensym("click"),
+        A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
+    class_addmethod(hradio_class, (t_method)hradio_dialog, gensym("dialog"),
+        A_GIMME, 0);
+    iemgui_class_addmethods(hradio_class);
+    radio_addmethods(hradio_class);
+    hscalehandle_class = class_new(gensym("_scalehandle"), 0, 0,
+        sizeof(t_scalehandle), CLASS_PD, 0);
+    class_addmethod(hscalehandle_class, (t_method)hradio__clickhook,
+        gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
+    class_addmethod(hscalehandle_class, (t_method)hradio__motionhook,
+        gensym("_motion"), A_FLOAT, A_FLOAT, 0);
+
+    wb_init(&hradio_widgetbehavior,hradio_getrect,hradio_newclick);
+    class_setwidget(hradio_class, &hradio_widgetbehavior);
+    class_sethelpsymbol(hradio_class, gensym("hradio"));
+    class_setsavefn(hradio_class, hradio_save);
+    class_setpropertiesfn(hradio_class, hradio_properties);
+
+        /* obsolete version (0.34-0.35) */
+    hradio_old_class = class_new(gensym("hdl"), (t_newmethod)radio_new,
+        (t_method)radio_free, sizeof(t_radio), 0, A_GIMME, 0);
+    class_addcreator((t_newmethod)radio_new, gensym("rdb"), A_GIMME, 0);
+    class_addcreator((t_newmethod)radio_new, gensym("radiobut"), A_GIMME, 0);
+    class_addcreator((t_newmethod)radio_new, gensym("radiobutton"),
+        A_GIMME, 0);
+    class_addbang(hradio_old_class, radio_bang);
+    class_addfloat(hradio_old_class, radio_float);
+    class_addmethod(hradio_old_class, (t_method)hradio_click, gensym("click"),
+        A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
+    class_addmethod(hradio_old_class, (t_method)hradio_dialog,
+        gensym("dialog"), A_GIMME, 0);
+    radio_addmethods(hradio_old_class);
+    iemgui_class_addmethods(hradio_old_class);
+    class_setwidget(hradio_old_class, &hradio_widgetbehavior);
+    class_sethelpsymbol(hradio_old_class, gensym("hradio"));
+}
+
+void g_vradio_setup(void)
+{
+    vradio_class = class_new(gensym("vradio"), (t_newmethod)radio_new,
+        (t_method)radio_free, sizeof(t_radio), 0, A_GIMME, 0);
+    class_addbang(vradio_class, radio_bang);
+    class_addfloat(vradio_class, radio_float);
+    class_addmethod(vradio_class, (t_method)vradio_click, gensym("click"),
+        A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
+    class_addmethod(vradio_class, (t_method)vradio_dialog, gensym("dialog"),
+        A_GIMME, 0);
+    radio_addmethods(vradio_class);
+    iemgui_class_addmethods(vradio_class);
+ 
+    vscalehandle_class = class_new(gensym("_scalehandle"), 0, 0,
+        sizeof(t_scalehandle), CLASS_PD, 0);
+    class_addmethod(vscalehandle_class, (t_method)vradio__clickhook,
+        gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
+    class_addmethod(vscalehandle_class, (t_method)vradio__motionhook,
+        gensym("_motion"), A_FLOAT, A_FLOAT, 0);
+
+    wb_init(&vradio_widgetbehavior,vradio_getrect,vradio_newclick);
+    class_setwidget(vradio_class, &vradio_widgetbehavior);
+    class_sethelpsymbol(vradio_class, gensym("vradio"));
+    class_setsavefn(vradio_class, vradio_save);
+    class_setpropertiesfn(vradio_class, vradio_properties);
+
+        /* obsolete version (0.34-0.35) */
+    vradio_old_class = class_new(gensym("vdl"), (t_newmethod)radio_new,
+        (t_method)radio_free, sizeof(t_radio), 0, A_GIMME, 0);
+    class_addbang(vradio_old_class, radio_bang);
+    class_addfloat(vradio_old_class, radio_float);
+    class_addmethod(vradio_old_class, (t_method)vradio_click, gensym("click"),
+        A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
+    class_addmethod(vradio_old_class, (t_method)vradio_dialog,
+        gensym("dialog"), A_GIMME, 0);
+    radio_addmethods(vradio_old_class);
+    iemgui_class_addmethods(vradio_old_class);
+    class_setwidget(vradio_old_class, &vradio_widgetbehavior);
+    class_sethelpsymbol(vradio_old_class, gensym("vradio"));
+}
diff --git a/pd/src/g_slider.c b/pd/src/g_slider.c
new file mode 100644
index 0000000000000000000000000000000000000000..aea0eb354fb6ab92ea72a4da31a296575aafe139
--- /dev/null
+++ b/pd/src/g_slider.c
@@ -0,0 +1,949 @@
+// g_slider.c
+// written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 as hdial/vdial.
+// thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja.
+// Copyright (c) 2014 by Mathieu Bouchard. (rewrite)
+// For information on usage and redistribution, and for a DISCLAIMER OF ALL
+// WARRANTIES, see the file, "LICENSE.txt", in this distribution.
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "m_pd.h"
+#include "g_canvas.h"
+#include "g_all_guis.h"
+#include <math.h>
+
+static t_class *hscalehandle_class;
+static t_class *vscalehandle_class;
+extern int gfxstub_haveproperties(void *key);
+static void hslider_draw_select(t_slider *x, t_glist *glist);
+static void vslider_draw_select(t_slider *x, t_glist *glist);
+t_widgetbehavior vslider_widgetbehavior;
+t_widgetbehavior hslider_widgetbehavior;
+t_class *hslider_class;
+t_class *vslider_class;
+
+static void slider_draw_update(t_gobj *client, t_glist *glist)
+{
+    t_slider *x = (t_slider *)client;
+    if (!x->x_gui.x_changed) return;
+    x->x_gui.x_changed = 0;
+    if (!glist_isvisible(glist)) return;
+    t_canvas *canvas=glist_getcanvas(glist);
+    int x1=text_xpix(&x->x_gui.x_obj, glist), x2=x1+x->x_gui.x_w;
+    int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h;
+    if (x->x_orient) y2+=5; else x2+=5;
+    int r;
+    if (x->x_orient) {
+        r=y2-3 - (x->x_val+50)/100;
+        sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n",
+            canvas, x, x1+2, r, x2-2, r);
+    } else {
+        r=x1+3 + (x->x_val+50)/100;
+        sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n",
+            canvas, x, r, y1+2, r, y2-2);
+    }
+    int t = x->x_thick;
+    x->x_thick = x->x_val == x->x_center;
+    if (t!=x->x_thick)
+        sys_vgui(".x%lx.c itemconfigure %lxKNOB -strokewidth %d\n",
+            canvas, x, 4*x->x_thick+3);
+}
+
+static void slider_draw_io(t_slider *x, t_glist *glist, int old_snd_rcv_flags)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    iemgui_io_draw(&x->x_gui,canvas,old_snd_rcv_flags);
+}
+static void slider_draw_new(t_slider *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    int x1=text_xpix(&x->x_gui.x_obj, glist), x2=x1+x->x_gui.x_w;
+    int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h;
+    if (x->x_orient) y2+=5; else x2+=5;
+    int r;
+    if (x->x_orient) r = y2-3 - (x->x_val + 50)/100;
+    else             r = x1+3 + (x->x_val + 50)/100;
+    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
+    iemgui_base_draw_new(&x->x_gui, canvas, nlet_tag);
+    scalehandle_draw_new(x->x_gui. x_handle,canvas);
+    scalehandle_draw_new(x->x_gui.x_lhandle,canvas);
+    if (x->x_orient) {
+        sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 "
+            "-stroke #%6.6x -tags {%lxKNOB %lxOBJ %s text iemgui}\n",
+            canvas, x1+2, r, x2-2, r, x->x_gui.x_fcol, x, x, nlet_tag);
+    } else {
+        sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 "
+            "-stroke #%6.6x -tags {%lxKNOB %lxOBJ %s text iemgui}\n",
+            canvas, r, y1+2, r, y2-2, x->x_gui.x_fcol, x, x, nlet_tag);
+    }
+    iemgui_label_draw_new(&x->x_gui,canvas,x1,y1,nlet_tag);
+    slider_draw_io(x,glist,7);
+}
+
+static void slider_draw_move(t_slider *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    if (!glist_isvisible(canvas)) return;
+    int x1=text_xpix(&x->x_gui.x_obj, glist), x2=x1+x->x_gui.x_w;
+    int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h;
+    if (x->x_orient) y2+=5; else x2+=5;
+    int r;
+    if (x->x_orient) r = y2-3 - (x->x_val + 50)/100;
+    else             r = x1+3 + (x->x_val + 50)/100;
+    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
+    iemgui_base_draw_move(&x->x_gui, canvas, nlet_tag);
+    if (x->x_orient)
+        sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n",
+            canvas, x, x1+2, r, x2-2, r);
+    else
+        sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n",
+            canvas, x, r, y1+2, r, y2-2);
+    iemgui_label_draw_move(&x->x_gui,canvas,x1,y1);
+    iemgui_io_draw_move(&x->x_gui,canvas,nlet_tag);
+    if (x->x_gui.x_selected) {
+        if (x->x_orient) vslider_draw_select(x, x->x_gui.x_glist);
+        else             hslider_draw_select(x, x->x_gui.x_glist);
+    }
+    if (x->x_gui.x_selected) vslider_draw_select(x, x->x_gui.x_glist);
+}
+
+static void slider_draw_config(t_slider *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    iemgui_label_draw_config(&x->x_gui,canvas);
+    iemgui_base_draw_config(&x->x_gui,canvas);
+    sys_vgui(".x%lx.c itemconfigure %lxKNOB -stroke #%6.6x\n",
+        canvas, x, x->x_gui.x_fcol);
+}
+
+static void hslider_draw_select(t_slider *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    iemgui_base_draw_config(&x->x_gui,canvas);
+    if(x->x_gui.x_selected)
+    {
+        if (x->x_gui.x_glist == glist_getcanvas(glist))
+            scalehandle_draw_select2(&x->x_gui,glist,
+                x->x_gui.x_w+5-1,x->x_gui.x_h-1);
+    }
+    else scalehandle_draw_erase2(&x->x_gui,glist);
+    iemgui_label_draw_select(&x->x_gui,canvas);
+    iemgui_tag_selected(&x->x_gui,canvas);
+}
+static void vslider_draw_select(t_slider *x, t_glist *glist)
+{
+    t_canvas *canvas=glist_getcanvas(glist);
+    iemgui_base_draw_config(&x->x_gui,canvas);
+    if(x->x_gui.x_selected)
+    {
+        if (x->x_gui.x_glist == glist_getcanvas(glist))
+            scalehandle_draw_select2(&x->x_gui,glist,
+                x->x_gui.x_w-1,x->x_gui.x_h+5-1);
+    }
+    else scalehandle_draw_erase2(&x->x_gui,glist);
+    iemgui_label_draw_select(&x->x_gui,canvas);
+    iemgui_tag_selected(&x->x_gui,canvas);
+}
+
+void slider_check_minmax(t_slider *x, double min, double max);
+void hslider_check_width(t_slider *x, int w);
+void vslider_check_height(t_slider *x, int w);
+
+static void hslider__clickhook2(t_scalehandle *sh, t_slider *x) {
+    double w_change_ratio = (double)(x->x_gui.x_w + sh->h_dragx)
+        /(double)x->x_gui.x_w;
+    x->x_val = x->x_val * w_change_ratio;
+    hslider_check_width(x, x->x_gui.x_w + sh->h_dragx);
+    x->x_gui.x_h += sh->h_dragy;
+    slider_check_minmax(x, x->x_min, x->x_max);
+}
+static void vslider__clickhook2(t_scalehandle *sh, t_slider *x) {
+    double h_change_ratio = (double)(x->x_gui.x_h + sh->h_dragy)
+        /(double)x->x_gui.x_h;
+    x->x_val = x->x_val * h_change_ratio;
+    x->x_gui.x_w += sh->h_dragx;
+    vslider_check_height(x, x->x_gui.x_h + sh->h_dragy);
+    slider_check_minmax(x, x->x_min, x->x_max);
+}
+
+static void slider__clickhook(t_scalehandle *sh, t_floatarg f,
+    t_floatarg xxx, t_floatarg yyy)
+{
+    int newstate = (int)f;
+    if (sh->h_dragon && newstate == 0 && sh->h_scale)
+    {
+        t_slider *x = (t_slider *)(sh->h_master);
+        canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
+        if (sh->h_dragx || sh->h_dragy)
+        {
+            if (x->x_orient) vslider__clickhook2(sh,x);
+            else             hslider__clickhook2(sh,x);
+            canvas_dirty(x->x_gui.x_glist, 1);
+        }
+        if (glist_isvisible(x->x_gui.x_glist))
+        {
+            slider_draw_move(x, x->x_gui.x_glist);
+            scalehandle_unclick_scale(sh);
+        }
+    }
+    else iemgui__clickhook3(sh,newstate);
+}
+
+static void hslider__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2)
+{
+    if (sh->h_dragon && sh->h_scale)
+    {
+        t_slider *x = (t_slider *)(sh->h_master);
+        int dx = (int)f1, dy = (int)f2;
+        dx = maxi(dx, IEM_SL_MINSIZE-x->x_gui.x_w);
+        dy = maxi(dy,IEM_GUI_MINSIZE-x->x_gui.x_h);
+        sh->h_dragx = dx;
+        sh->h_dragy = dy;
+        scalehandle_drag_scale(sh);
+
+        int properties = gfxstub_haveproperties((void *)x);
+        if (properties)
+        {
+            int new_w = x->x_gui.x_w + sh->h_dragx;
+            int new_h = x->x_gui.x_h + sh->h_dragy;
+            properties_set_field_int(properties,"dim.w_ent",new_w);
+            properties_set_field_int(properties,"dim.h_ent",new_h);
+        }
+    }
+    scalehandle_dragon_label(sh,f1,f2);
+}
+static void vslider__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2)
+{
+    if (sh->h_dragon && sh->h_scale)
+    {
+        t_slider *x = (t_slider *)(sh->h_master);
+        int dx = (int)f1, dy = (int)f2;
+        dx = maxi(dx,IEM_GUI_MINSIZE-x->x_gui.x_w);
+        dy = maxi(dy, IEM_SL_MINSIZE-x->x_gui.x_h);
+        sh->h_dragx = dx;
+        sh->h_dragy = dy;
+        scalehandle_drag_scale(sh);
+
+        int properties = gfxstub_haveproperties((void *)x);
+        if (properties)
+        {
+            int new_w = x->x_gui.x_w + sh->h_dragx;
+            int new_h = x->x_gui.x_h + sh->h_dragy;
+            properties_set_field_int(properties,"dim.w_ent",new_w);
+            properties_set_field_int(properties,"dim.h_ent",new_h);
+        }
+    }
+    scalehandle_dragon_label(sh,f1,f2);
+}
+
+void hslider_draw(t_slider *x, t_glist *glist, int mode)
+{
+    if(mode == IEM_GUI_DRAW_MODE_UPDATE)
+        sys_queuegui(x, glist, slider_draw_update);
+    else if(mode == IEM_GUI_DRAW_MODE_MOVE)
+        slider_draw_move(x, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_NEW)
+    {
+        slider_draw_new(x, glist);
+        sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
+    }
+    else if(mode == IEM_GUI_DRAW_MODE_SELECT)
+        hslider_draw_select(x, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_ERASE)
+        iemgui_draw_erase(&x->x_gui, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_CONFIG)
+        slider_draw_config(x, glist);
+    else if(mode >= IEM_GUI_DRAW_MODE_IO)
+        slider_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO);
+}
+void vslider_draw(t_slider *x, t_glist *glist, int mode)
+{
+    if(mode == IEM_GUI_DRAW_MODE_UPDATE)
+        sys_queuegui(x, glist, slider_draw_update);
+    else if(mode == IEM_GUI_DRAW_MODE_MOVE)
+        slider_draw_move(x, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_NEW)
+    {
+        slider_draw_new(x, glist);
+        sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
+    }
+    else if(mode == IEM_GUI_DRAW_MODE_SELECT)
+        vslider_draw_select(x, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_ERASE)
+        iemgui_draw_erase(&x->x_gui, glist);
+    else if(mode == IEM_GUI_DRAW_MODE_CONFIG)
+        slider_draw_config(x, glist);
+    else if(mode >= IEM_GUI_DRAW_MODE_IO)
+        slider_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO);
+}
+
+static void hslider_getrect(t_gobj *z, t_glist *glist,
+                            int *xp1, int *yp1, int *xp2, int *yp2)
+{
+    t_slider *x = (t_slider *)z;
+
+    *xp1 = text_xpix(&x->x_gui.x_obj, glist);
+    *yp1 = text_ypix(&x->x_gui.x_obj, glist);
+    *xp2 = *xp1 + x->x_gui.x_w + 5;
+    *yp2 = *yp1 + x->x_gui.x_h;
+
+    iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
+}
+
+
+static void vslider_getrect(t_gobj *z, t_glist *glist,
+                            int *xp1, int *yp1, int *xp2, int *yp2)
+{
+    t_slider *x = (t_slider *)z;
+
+    *xp1 = text_xpix(&x->x_gui.x_obj, glist);
+    *yp1 = text_ypix(&x->x_gui.x_obj, glist);
+    *xp2 = *xp1 + x->x_gui.x_w;
+    *yp2 = *yp1 + x->x_gui.x_h + 5;
+
+    iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
+}
+
+static void hslider_save(t_gobj *z, t_binbuf *b)
+{
+    t_slider *x = (t_slider *)z;
+    int bflcol[3];
+    t_symbol *srl[3];
+
+    iemgui_save(&x->x_gui, srl, bflcol);
+    binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"),
+                (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
+                gensym("hsl"), x->x_gui.x_w, x->x_gui.x_h,
+                (t_float)x->x_min, (t_float)x->x_max,
+                x->x_lin0_log1, iem_symargstoint(&x->x_gui),
+                srl[0], srl[1], srl[2],
+                x->x_gui.x_ldx, x->x_gui.x_ldy,
+                iem_fstyletoint(&x->x_gui), x->x_gui.x_fontsize,
+                bflcol[0], bflcol[1], bflcol[2],
+                x->x_val, x->x_steady);
+    binbuf_addv(b, ";");
+}
+
+
+static void vslider_save(t_gobj *z, t_binbuf *b)
+{
+    t_slider *x = (t_slider *)z;
+    int bflcol[3];
+    t_symbol *srl[3];
+
+    iemgui_save(&x->x_gui, srl, bflcol);
+    binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"),
+                (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
+                gensym("vsl"), x->x_gui.x_w, x->x_gui.x_h, // diff
+                (t_float)x->x_min, (t_float)x->x_max,
+                x->x_lin0_log1, iem_symargstoint(&x->x_gui),
+                srl[0], srl[1], srl[2],
+                x->x_gui.x_ldx, x->x_gui.x_ldy,
+                iem_fstyletoint(&x->x_gui), x->x_gui.x_fontsize,
+                bflcol[0], bflcol[1], bflcol[2],
+                x->x_val, x->x_steady);
+    binbuf_addv(b, ";");
+}
+
+void hslider_check_width(t_slider *x, int w)
+{
+    if(w < IEM_SL_MINSIZE)
+        w = IEM_SL_MINSIZE;
+    x->x_gui.x_w = w;
+    x->x_center = (x->x_gui.x_w-1)*50;
+    if(x->x_val > (x->x_gui.x_w*100 - 100))
+    {
+        x->x_pos = x->x_gui.x_w*100 - 100;
+        x->x_val = x->x_pos;
+    }
+    if(x->x_lin0_log1)
+        x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_w - 1);
+    else
+        x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1);
+}
+
+void vslider_check_height(t_slider *x, int h)
+{
+    if(h < IEM_SL_MINSIZE)
+        h = IEM_SL_MINSIZE;
+    x->x_gui.x_h = h;
+    x->x_center = (x->x_gui.x_h-1)*50;
+    if(x->x_val > (x->x_gui.x_h*100 - 100))
+    {
+        x->x_pos = x->x_gui.x_h*100 - 100;
+        x->x_val = x->x_pos;
+    }
+    if(x->x_lin0_log1)
+        x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_h - 1);
+    else
+        x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_h - 1);
+}
+
+void slider_check_minmax(t_slider *x, double min, double max)
+{
+    if(x->x_lin0_log1)
+    {
+        if((min == 0.0)&&(max == 0.0))
+            max = 1.0;
+        if(max > 0.0)
+        {
+            if(min <= 0.0)
+                min = 0.01*max;
+        }
+        else
+        {
+            if(min > 0.0)
+                max = 0.01*min;
+        }
+    }
+    x->x_min = min;
+    x->x_max = max;
+    x->x_gui.x_reverse = x->x_min > x->x_max;
+    if(x->x_lin0_log1)
+        x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_w - 1);
+    else
+        x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1);
+}
+
+static void hslider_properties(t_gobj *z, t_glist *owner)
+{
+    t_slider *x = (t_slider *)z;
+    char buf[800];
+    t_symbol *srl[3];
+
+    iemgui_properties(&x->x_gui, srl);
+    sprintf(buf, "pdtk_iemgui_dialog %%s |hsl| \
+        --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \
+        -----------output-range:----------- %g left: %g right: %g \
+        %d lin log %d %d empty %d {%s} {%s} {%s} %d %d %d %d %d %d %d\n",
+        x->x_gui.x_w, IEM_SL_MINSIZE, x->x_gui.x_h, IEM_GUI_MINSIZE,
+        x->x_min, x->x_max, 0.0,/*no_schedule*/
+        x->x_lin0_log1, x->x_gui.x_loadinit, x->x_steady, -1,/*no multi, but iem-characteristic*/
+        srl[0]->s_name, srl[1]->s_name,
+        srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
+        x->x_gui.x_font_style, x->x_gui.x_fontsize,
+        0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol,
+        0xffffff & x->x_gui.x_lcol);
+    gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
+}
+static void vslider_properties(t_gobj *z, t_glist *owner)
+{
+    t_slider *x = (t_slider *)z;
+    char buf[800];
+    t_symbol *srl[3];
+
+    iemgui_properties(&x->x_gui, srl);
+    sprintf(buf, "pdtk_iemgui_dialog %%s |vsl| \
+        --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \
+        -----------output-range:----------- %g bottom: %g top: %g \
+        %d lin log %d %d empty %d {%s} {%s} {%s} %d %d %d %d %d %d %d\n",
+        x->x_gui.x_w, IEM_GUI_MINSIZE, x->x_gui.x_h, IEM_SL_MINSIZE,
+        x->x_min, x->x_max, 0.0,/*no_schedule*/
+        x->x_lin0_log1, x->x_gui.x_loadinit, x->x_steady, -1,/*no multi, but iem-characteristic*/
+        srl[0]->s_name, srl[1]->s_name,
+        srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
+        x->x_gui.x_font_style, x->x_gui.x_fontsize,
+        0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol,
+        0xffffff & x->x_gui.x_lcol);
+    gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
+}
+
+static void slider_bang(t_slider *x)
+{
+    double out;
+
+    if(x->x_lin0_log1)
+        out = x->x_min*exp(x->x_k*(double)(x->x_val)*0.01);
+    else {
+        if (x->x_is_last_float && x->x_last <= x->x_max &&
+            x->x_last >= x->x_min)
+            out = x->x_last;
+        else
+            out = (double)(x->x_val)*0.01*x->x_k + x->x_min;
+    }
+    if((out < 1.0e-10)&&(out > -1.0e-10))
+        out = 0.0;
+    outlet_float(x->x_gui.x_obj.ob_outlet, out);
+    if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
+        pd_float(x->x_gui.x_snd->s_thing, out);
+}
+
+static void hslider_dialog(t_slider *x, t_symbol *s, int argc, t_atom *argv)
+{
+    canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
+
+    t_symbol *srl[3];
+    int w = (int)atom_getintarg(0, argc, argv);
+    int h = (int)atom_getintarg(1, argc, argv);
+    double min = (double)atom_getfloatarg(2, argc, argv);
+    double max = (double)atom_getfloatarg(3, argc, argv);
+    int lilo = (int)atom_getintarg(4, argc, argv);
+    int steady = (int)atom_getintarg(17, argc, argv);
+    int sr_flags;
+
+    if(lilo != 0) lilo = 1;
+    x->x_lin0_log1 = lilo;
+    if(steady)
+        x->x_steady = 1;
+    else
+        x->x_steady = 0;
+    sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
+    x->x_gui.x_h = iemgui_clip_size(h); //diff
+    int old_width = x->x_gui.x_w; //diff
+    hslider_check_width(x, w); //diff
+    if (x->x_gui.x_w != old_width) //diff
+    {
+        x->x_val = x->x_val * ((double)x->x_gui.x_w/(double)old_width); //diff
+    }
+    slider_check_minmax(x, min, max);
+    x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
+    x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
+    //x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
+    //canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
+    iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
+
+    if (x->x_gui.x_selected) hslider_draw_select(x, x->x_gui.x_glist); //diff
+    scrollbar_update(x->x_gui.x_glist);
+}
+static void vslider_dialog(t_slider *x, t_symbol *s, int argc, t_atom *argv)
+{
+    canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
+
+    t_symbol *srl[3];
+    int w = (int)atom_getintarg(0, argc, argv);
+    int h = (int)atom_getintarg(1, argc, argv);
+    double min = (double)atom_getfloatarg(2, argc, argv);
+    double max = (double)atom_getfloatarg(3, argc, argv);
+    int lilo = (int)atom_getintarg(4, argc, argv);
+    int steady = (int)atom_getintarg(17, argc, argv);
+    int sr_flags;
+
+    if(lilo != 0) lilo = 1;
+    x->x_lin0_log1 = lilo;
+    if(steady)
+        x->x_steady = 1;
+    else
+        x->x_steady = 0;
+    sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
+    x->x_gui.x_w = iemgui_clip_size(w);
+    int old_height = x->x_gui.x_h;
+    vslider_check_height(x, h);
+    if (x->x_gui.x_h != old_height)
+    {
+        x->x_val = x->x_val * ((double)x->x_gui.x_h/(double)old_height);
+    }
+    slider_check_minmax(x, min, max);
+    x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
+    x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
+    //x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
+    //canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
+    iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
+
+    if (x->x_gui.x_selected) vslider_draw_select(x, x->x_gui.x_glist);
+    scrollbar_update(x->x_gui.x_glist);
+}
+
+static void hslider_motion(t_slider *x, t_floatarg dx, t_floatarg dy)
+{
+    x->x_is_last_float = 0;
+    int old = x->x_val;
+
+    if(x->x_gui.x_finemoved)
+        x->x_pos += (int)dx;
+    else
+        x->x_pos += 100*(int)dx;
+    x->x_val = x->x_pos;
+    if(x->x_val > (100*x->x_gui.x_w - 100))
+    {
+        x->x_val = 100*x->x_gui.x_w - 100;
+        x->x_pos += 50;
+        x->x_pos -= x->x_pos%100;
+    }
+    if(x->x_val < 0)
+    {
+        x->x_val = 0;
+        x->x_pos -= 50;
+        x->x_pos -= x->x_pos%100;
+    }
+    if(old != x->x_val)
+    {
+        x->x_gui.x_changed = 1;
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+        slider_bang(x);
+    }
+}
+static void vslider_motion(t_slider *x, t_floatarg dx, t_floatarg dy)
+{
+    x->x_is_last_float = 0;
+    int old = x->x_val;
+
+    if(x->x_gui.x_finemoved)
+        x->x_pos -= (int)dy;
+    else
+        x->x_pos -= 100*(int)dy;
+    x->x_val = x->x_pos;
+    if(x->x_val > (100*x->x_gui.x_h - 100))
+    {
+        x->x_val = 100*x->x_gui.x_h - 100;
+        x->x_pos += 50;
+        x->x_pos -= x->x_pos%100;
+    }
+    if(x->x_val < 0)
+    {
+        x->x_val = 0;
+        x->x_pos -= 50;
+        x->x_pos -= x->x_pos%100;
+    }
+    if(old != x->x_val)
+    {
+        x->x_gui.x_changed = 1;
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+        slider_bang(x);
+    }
+}
+
+static void hslider_click(t_slider *x, t_floatarg xpos, t_floatarg ypos,
+    t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
+{
+    if(!x->x_steady)
+        x->x_val = (int)(100.0 * (xpos -
+            text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)));
+    if(x->x_val > (100*x->x_gui.x_w - 100))
+        x->x_val = 100*x->x_gui.x_w - 100;
+    if(x->x_val < 0)
+        x->x_val = 0;
+    if (x->x_pos != x->x_val)
+    {
+        x->x_pos = x->x_val;
+        x->x_gui.x_changed = 1;
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+    }
+    slider_bang(x);
+    glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g,
+        (t_glistmotionfn)hslider_motion, 0, xpos, ypos);
+}
+static void vslider_click(t_slider *x, t_floatarg xpos, t_floatarg ypos,
+    t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
+{
+    if(!x->x_steady)
+        x->x_val = (int)(100.0 * (x->x_gui.x_h +
+            text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist) - ypos));
+    if(x->x_val > (100*x->x_gui.x_h - 100))
+        x->x_val = 100*x->x_gui.x_h - 100;
+    if(x->x_val < 0)
+        x->x_val = 0;
+    if (x->x_pos != x->x_val)
+    {
+        x->x_pos = x->x_val;
+        x->x_gui.x_changed = 1;
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+    }
+    slider_bang(x);
+    glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g,
+        (t_glistmotionfn)vslider_motion, 0, xpos, ypos);
+}
+
+static int hslider_newclick(t_gobj *z, struct _glist *glist,
+    int xpix, int ypix, int shift, int alt, int dbl, int doit)
+{
+    t_slider *x = (t_slider *)z;
+
+    if(doit)
+    {
+        hslider_click(x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift,
+            0, (t_floatarg)alt);
+        if(shift)
+            x->x_gui.x_finemoved = 1;
+        else
+            x->x_gui.x_finemoved = 0;
+    }
+    return (1);
+}
+static int vslider_newclick(t_gobj *z, struct _glist *glist,
+    int xpix, int ypix, int shift, int alt, int dbl, int doit)
+{
+    t_slider *x = (t_slider *)z;
+
+    if(doit)
+    {
+        vslider_click(x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift,
+            0, (t_floatarg)alt);
+        if(shift)
+            x->x_gui.x_finemoved = 1;
+        else
+            x->x_gui.x_finemoved = 0;
+    }
+    return (1);
+}
+
+static void slider_set(t_slider *x, t_floatarg f)
+{
+    double g;
+    if(x->x_gui.x_reverse)
+    {
+        if(f > x->x_min) f = x->x_min;
+        if(f < x->x_max) f = x->x_max;
+    }
+    else
+    {
+        if(f > x->x_max) f = x->x_max;
+        if(f < x->x_min) f = x->x_min;
+    }
+    if(x->x_lin0_log1)
+        g = log(f/x->x_min)/x->x_k;
+    else
+        g = (f - x->x_min) / x->x_k;
+    x->x_val = (int)(100.0*g + 0.49999);
+    if (x->x_pos != x->x_val)
+    {
+        x->x_pos = x->x_val;
+        x->x_gui.x_changed = 1;
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+    }
+}
+
+static void slider_float(t_slider *x, t_floatarg f)
+{
+    x->x_is_last_float = 1;
+    x->x_last = f;
+    slider_set(x, f);
+    if(x->x_gui.x_put_in2out)
+        slider_bang(x);
+}
+
+static void hslider_size(t_slider *x, t_symbol *s, int ac, t_atom *av)
+{
+    hslider_check_width(x, (int)atom_getintarg(0, ac, av));
+    if(ac > 1)
+        x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av));
+    iemgui_size(&x->x_gui);
+}
+static void vslider_size(t_slider *x, t_symbol *s, int ac, t_atom *av)
+{
+    x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
+    if(ac > 1)
+        vslider_check_height(x, (int)atom_getintarg(1, ac, av));
+    iemgui_size(&x->x_gui);
+}
+
+static void slider_range(t_slider *x, t_symbol *s, int ac, t_atom *av)
+{
+    slider_check_minmax(x, (double)atom_getfloatarg(0, ac, av),
+                         (double)atom_getfloatarg(1, ac, av));
+}
+
+static void slider_log(t_slider *x)
+{
+    x->x_lin0_log1 = 1;
+    slider_check_minmax(x, x->x_min, x->x_max);
+}
+
+static void hslider_lin(t_slider *x)
+{
+    x->x_lin0_log1 = 0;
+    x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1);
+}
+static void vslider_lin(t_slider *x)
+{
+    x->x_lin0_log1 = 0;
+    x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_h - 1);
+}
+
+static void slider_init(t_slider *x, t_floatarg f)
+{
+    x->x_gui.x_loadinit = (f==0.0)?0:1;
+}
+
+static void slider_steady(t_slider *x, t_floatarg f)
+{
+    x->x_steady = (f==0.0)?0:1;
+}
+
+static void slider_loadbang(t_slider *x)
+{
+    if(!sys_noloadbang && x->x_gui.x_loadinit)
+    {
+        x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
+        slider_bang(x);
+    }
+}
+
+static void *slider_new(t_symbol *s, int argc, t_atom *argv)
+{
+    int orient = s==gensym("vsl") || s==gensym("vslider");
+    t_slider *x = (t_slider *)pd_new(orient ? vslider_class : hslider_class);
+    x->x_orient = orient;
+    int bflcol[]={-262144, -1, -1};
+    int lilo=0;
+    int w,h,ldx,ldy,fs=10, v=0, steady=1;
+    if (orient) {
+        w=IEM_GUI_DEFAULTSIZE; h=IEM_SL_DEFAULTSIZE; ldx=0, ldy=-9;
+    } else {
+        w=IEM_SL_DEFAULTSIZE; h=IEM_GUI_DEFAULTSIZE; ldx=-2; ldy=-8;
+    }
+    double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
+
+    iem_inttosymargs(&x->x_gui, 0);
+    iem_inttofstyle(&x->x_gui, 0);
+
+    if(((argc == 17)||(argc == 18))&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)
+       &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3)
+       &&IS_A_FLOAT(argv,4)&&IS_A_FLOAT(argv,5)
+       &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6))
+       &&(IS_A_SYMBOL(argv,7)||IS_A_FLOAT(argv,7))
+       &&(IS_A_SYMBOL(argv,8)||IS_A_FLOAT(argv,8))
+       &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10)
+       &&IS_A_FLOAT(argv,11)&&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13)
+       &&IS_A_FLOAT(argv,14)&&IS_A_FLOAT(argv,15)&&IS_A_FLOAT(argv,16))
+    {
+        w = (int)atom_getintarg(0, argc, argv);
+        h = (int)atom_getintarg(1, argc, argv);
+        min = (double)atom_getfloatarg(2, argc, argv);
+        max = (double)atom_getfloatarg(3, argc, argv);
+        lilo = (int)atom_getintarg(4, argc, argv);
+        iem_inttosymargs(&x->x_gui, atom_getintarg(5, argc, argv));
+        iemgui_new_getnames(&x->x_gui, 6, argv);
+        ldx = (int)atom_getintarg(9, argc, argv);
+        ldy = (int)atom_getintarg(10, argc, argv);
+        iem_inttofstyle(&x->x_gui, atom_getintarg(11, argc, argv));
+        fs = (int)atom_getintarg(12, argc, argv);
+        bflcol[0] = (int)atom_getintarg(13, argc, argv);
+        bflcol[1] = (int)atom_getintarg(14, argc, argv);
+        bflcol[2] = (int)atom_getintarg(15, argc, argv);
+        v = (int)atom_getintarg(16, argc, argv);
+    }
+    else iemgui_new_getnames(&x->x_gui, 6, 0);
+    if((argc == 18)&&IS_A_FLOAT(argv,17))
+        steady = (int)atom_getintarg(17, argc, argv);
+    x->x_gui.x_draw = orient ? (t_iemfunptr)vslider_draw : (t_iemfunptr)hslider_draw;
+    x->x_is_last_float = 0;
+    x->x_last = 0.0;
+    x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
+    if(x->x_gui.x_loadinit)
+        x->x_val = v;
+    else
+        x->x_val = 0;
+    x->x_pos = x->x_val;
+    if(lilo != 0) lilo = 1;
+    x->x_lin0_log1 = lilo;
+    if(steady != 0) steady = 1;
+    x->x_steady = steady;
+    if (x->x_gui.x_font_style<0 || x->x_gui.x_font_style>2) x->x_gui.x_font_style=0;
+    if(iemgui_has_rcv(&x->x_gui))
+        pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
+    x->x_gui.x_ldx = ldx;
+    x->x_gui.x_ldy = ldy;
+    if(fs < 4)
+        fs = 4;
+    x->x_gui.x_fontsize = fs;
+    if (orient) {
+        x->x_gui.x_w = iemgui_clip_size(w);
+        vslider_check_height(x, h);
+    } else {
+        x->x_gui.x_h = iemgui_clip_size(h);
+        hslider_check_width(x, w);
+    }
+    slider_check_minmax(x, min, max);
+    iemgui_all_colfromload(&x->x_gui, bflcol);
+    x->x_thick = 0;
+    iemgui_verify_snd_ne_rcv(&x->x_gui);
+    outlet_new(&x->x_gui.x_obj, &s_float);
+
+    t_class *sc = orient ? vscalehandle_class : hscalehandle_class;
+    x->x_gui. x_handle = scalehandle_new(sc,(t_iemgui *)x,1);
+    x->x_gui.x_lhandle = scalehandle_new(sc,(t_iemgui *)x,0);
+    x->x_gui.x_obj.te_iemgui = 1;
+    x->x_gui.x_changed = 0;
+
+    return (x);
+}
+
+static void slider_free(t_slider *x)
+{
+    if(iemgui_has_rcv(&x->x_gui))
+        pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
+    gfxstub_deleteforkey(x);
+
+    if (x->x_gui. x_handle) scalehandle_free(x->x_gui. x_handle);
+    if (x->x_gui.x_lhandle) scalehandle_free(x->x_gui.x_lhandle);
+}
+
+void slider_addmethods(t_class *c) {
+    class_addmethod(c, (t_method)slider_loadbang,
+        gensym("loadbang"), 0);
+    class_addmethod(c, (t_method)slider_set,
+        gensym("set"), A_FLOAT, 0);
+    class_addmethod(c, (t_method)slider_log, gensym("log"), 0);
+    class_addmethod(c, (t_method)slider_init,
+        gensym("init"), A_FLOAT, 0);
+    class_addmethod(c, (t_method)slider_steady,
+        gensym("steady"), A_FLOAT, 0);
+    class_addmethod(c, (t_method)slider_range,
+        gensym("range"), A_GIMME, 0);
+}
+
+void g_hslider_setup(void)
+{
+    hslider_class = class_new(gensym("hsl"), (t_newmethod)slider_new,
+        (t_method)slider_free, sizeof(t_slider), 0, A_GIMME, 0);
+    class_addcreator((t_newmethod)slider_new, gensym("hslider"), A_GIMME, 0);
+    class_addbang(hslider_class,slider_bang);
+    class_addfloat(hslider_class,slider_float);
+    class_addmethod(hslider_class, (t_method)hslider_click, gensym("click"),
+        A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
+    class_addmethod(hslider_class, (t_method)hslider_motion, gensym("motion"),
+        A_FLOAT, A_FLOAT, 0);
+    class_addmethod(hslider_class, (t_method)hslider_dialog, gensym("dialog"),
+        A_GIMME, 0);
+    slider_addmethods(hslider_class);
+    class_addmethod(hslider_class, (t_method)hslider_size,
+        gensym("size"), A_GIMME, 0);
+    iemgui_class_addmethods(hslider_class);
+    class_addmethod(hslider_class, (t_method)hslider_lin, gensym("lin"), 0);
+ 
+    hscalehandle_class = class_new(gensym("_scalehandle"), 0, 0,
+        sizeof(t_scalehandle), CLASS_PD, 0);
+    class_addmethod(hscalehandle_class, (t_method)slider__clickhook,
+        gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
+    class_addmethod(hscalehandle_class, (t_method)hslider__motionhook,
+        gensym("_motion"), A_FLOAT, A_FLOAT, 0);
+
+    wb_init(&hslider_widgetbehavior,hslider_getrect,hslider_newclick);
+    class_setwidget(hslider_class, &hslider_widgetbehavior);
+    class_sethelpsymbol(hslider_class, gensym("hslider"));
+    class_setsavefn(hslider_class, hslider_save);
+    class_setpropertiesfn(hslider_class, hslider_properties);
+}
+void g_vslider_setup(void)
+{
+    vslider_class = class_new(gensym("vsl"), (t_newmethod)slider_new,
+        (t_method)slider_free, sizeof(t_slider), 0, A_GIMME, 0);
+    class_addcreator((t_newmethod)slider_new, gensym("vslider"), A_GIMME, 0);
+    class_addbang(vslider_class,slider_bang);
+    class_addfloat(vslider_class,slider_float);
+    class_addmethod(vslider_class, (t_method)vslider_click, gensym("click"),
+        A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
+    class_addmethod(vslider_class, (t_method)vslider_motion, gensym("motion"),
+        A_FLOAT, A_FLOAT, 0);
+    class_addmethod(vslider_class, (t_method)vslider_dialog, gensym("dialog"),
+        A_GIMME, 0);
+    slider_addmethods(hslider_class);
+    class_addmethod(vslider_class, (t_method)vslider_size,
+        gensym("size"), A_GIMME, 0);
+    iemgui_class_addmethods(vslider_class);
+    class_addmethod(vslider_class, (t_method)vslider_lin, gensym("lin"), 0);
+ 
+    vscalehandle_class = class_new(gensym("_scalehandle"), 0, 0,
+        sizeof(t_scalehandle), CLASS_PD, 0);
+    class_addmethod(vscalehandle_class, (t_method)slider__clickhook,
+        gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
+    class_addmethod(vscalehandle_class, (t_method)vslider__motionhook,
+        gensym("_motion"), A_FLOAT, A_FLOAT, 0);
+
+    wb_init(&vslider_widgetbehavior,vslider_getrect,vslider_newclick);
+    class_setwidget(vslider_class, &vslider_widgetbehavior);
+    class_sethelpsymbol(vslider_class, gensym("vslider"));
+    class_setsavefn(vslider_class, vslider_save);
+    class_setpropertiesfn(vslider_class, vslider_properties);
+}
diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c
index e3f749087580619e08bd8b2e088b063c220d7d12..9f677a76bef5018be1a952475560b3688a6c7826 100644
--- a/pd/src/g_toggle.c
+++ b/pd/src/g_toggle.c
@@ -5,26 +5,15 @@
 /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
 /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
 
-#include "config.h"
-
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <ctype.h>
 #include "m_pd.h"
 #include "g_canvas.h"
-#include "t_tk.h"
 #include "g_all_guis.h"
 #include <math.h>
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_IO_H
-#include <io.h>
-#endif
-
+static t_class *scalehandle_class;
 extern int gfxstub_haveproperties(void *key);
 void toggle_draw_select(t_toggle* x, t_glist* glist);
  
@@ -152,19 +141,7 @@ static void toggle__clickhook(t_scalehandle *sh, t_floatarg f,
             scalehandle_unclick_scale(sh);
         }
     }
-    else if (!sh->h_dragon && newstate && sh->h_scale)
-    {
-        scalehandle_click_scale(sh);
-    }
-    else if (sh->h_dragon && !newstate && !sh->h_scale)
-    {
-        scalehandle_unclick_label(sh);
-    }
-    else if(!sh->h_dragon && newstate && !sh->h_scale)
-    {
-        scalehandle_click_label(sh);
-    }
-    sh->h_dragon = newstate;
+    else iemgui__clickhook3(sh,newstate);
 }
 
 static void toggle__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2)
diff --git a/pd/src/g_vdial.c b/pd/src/g_vdial.c
index 076cd224ee05098e7aa7d325e9f54157f23b1f97..8b137891791fe96927ad78e64b0aad7bded08bdc 100644
--- a/pd/src/g_vdial.c
+++ b/pd/src/g_vdial.c
@@ -1,685 +1 @@
-/* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
 
-/* vdial.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
-/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
-
-/* name change to vradio by MSP (it's a radio button really) and changed to
-put out a "float" as in sliders, toggles, etc. */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include "m_pd.h"
-#include "g_canvas.h"
-#include "t_tk.h"
-#include "g_all_guis.h"
-#include <math.h>
-
-extern int gfxstub_haveproperties(void *key);
-void vradio_draw_select(t_vradio* x, t_glist* glist);
-
-/* ------------- vdl     gui-vertical radio button ---------------------- */
-
-t_widgetbehavior vradio_widgetbehavior;
-static t_class *vradio_class, *vradio_old_class;
-
-/* widget helper functions */
-
-void vradio_draw_update(t_gobj *client, t_glist *glist)
-{
-    t_hradio *x = (t_hradio *)client;
-    if(!glist_isvisible(glist)) return;
-    t_canvas *canvas=glist_getcanvas(glist);
-    sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n",
-        canvas, x, x->x_drawn, x->x_gui.x_bcol, x->x_gui.x_bcol);
-    sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n",
-        canvas, x, x->x_on,    x->x_gui.x_fcol, x->x_gui.x_fcol);
-    x->x_drawn = x->x_on;
-}
-
-void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    iemgui_io_draw(&x->x_gui,canvas,old_snd_rcv_flags);
-}
-
-void vradio_draw_new(t_vradio *x, t_glist *glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
-    int x1=text_xpix(&x->x_gui.x_obj, glist);
-    int y1=text_ypix(&x->x_gui.x_obj, glist), yi=y1;
-    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-
-    iemgui_base_draw_new(&x->x_gui, canvas, nlet_tag);
-    scalehandle_draw_new(x->x_gui. x_handle,canvas);
-    scalehandle_draw_new(x->x_gui.x_lhandle,canvas);
-
-    for(i=0; i<n; i++)
-    {
-        if (i) sys_vgui(".x%lx.c create pline %d %d %d %d "
-            "-stroke $pd_colors(iemgui_border) "
-            "-tags {%lxBASE%d %lxBASEL %lxOBJ %s text iemgui border}\n",
-            canvas, x1, yi, x1+d, yi, x, i, x, x, nlet_tag);
-        sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x "
-            "-stroke #%6.6x -tags {%lxBUT%d %lxOBJ %s text iemgui}\n",
-            canvas, x1+s, yi+s, x1+d-s, yi+d-s,
-            (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
-            (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
-            x, i, x, nlet_tag);
-        yi += d;
-        x->x_drawn = x->x_on;
-    }
-    iemgui_label_draw_new(&x->x_gui,canvas,x1,y1,nlet_tag);
-    vradio_draw_io(x,glist,7);
-}
-
-void vradio_draw_move(t_vradio *x, t_glist *glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    if (!glist_isvisible(canvas)) return;
-    int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
-    int x1=text_xpix(&x->x_gui.x_obj, glist);
-    int y1=text_ypix(&x->x_gui.x_obj, glist), yi=y1;
-
-    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-    for(i=0; i<n; i++)
-    {
-        sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n",
-            canvas, x, i, x1, yi, x1+d, yi);
-        sys_vgui(".x%lx.c coords %lxBUT%d %d %d %d %d\n",
-            canvas, x, i, x1+s, yi+s, x1+d-s, yi+d-s);
-        yi += d;
-    }
-    iemgui_label_draw_move(&x->x_gui,canvas,x1,y1);
-    iemgui_io_draw_move(&x->x_gui,canvas,nlet_tag);
-    if (x->x_gui.x_selected) vradio_draw_select(x, x->x_gui.x_glist);
-}
-
-void vradio_draw_config(t_vradio* x, t_glist* glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    int n=x->x_number, i;
-    iemgui_label_draw_config(&x->x_gui,canvas);
-    iemgui_base_draw_config(&x->x_gui,canvas);
-    for(i=0; i<n; i++)
-    {
-        sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n",
-            canvas, x, i,
-            (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol,
-            (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol);
-    }
-}
-
-void vradio_draw_select(t_vradio* x, t_glist* glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    iemgui_base_draw_config(&x->x_gui,canvas);
-    if(x->x_gui.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))
-        {
-            scalehandle_draw_select2(&x->x_gui,glist,
-                x->x_gui.x_w-1,x->x_gui.x_h*x->x_number-1);
-        }
-    }
-    else
-    {
-        scalehandle_draw_erase2(&x->x_gui,glist);
-    }
-    iemgui_label_draw_select(&x->x_gui,canvas);
-    iemgui_tag_selected(&x->x_gui,canvas);
-}
-
-static void vradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx,
-    t_floatarg yyy)
-{
-    t_vradio *x = (t_vradio *)(sh->h_master);
-    int newstate = (int)f;
-    if (sh->h_dragon && newstate == 0 && sh->h_scale)
-    {
-        canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
-        if (sh->h_dragx || sh->h_dragy)
-        {
-            x->x_gui.x_w += sh->h_dragx;
-            x->x_gui.x_h += sh->h_dragx;
-            canvas_dirty(x->x_gui.x_glist, 1);
-        }
-        if (glist_isvisible(x->x_gui.x_glist))
-        {
-            vradio_draw_move(x, x->x_gui.x_glist);
-            scalehandle_unclick_scale(sh);
-        }
-    }
-    else if (!sh->h_dragon && newstate && sh->h_scale)
-    {
-        scalehandle_click_scale(sh);
-    }
-    else if (sh->h_dragon && newstate == 0 && !sh->h_scale)
-    {
-        scalehandle_unclick_label(sh);
-    }
-    else if (!sh->h_dragon && newstate && !sh->h_scale)
-    {
-        scalehandle_click_label(sh);
-    }
-    sh->h_dragon = newstate;
-}
-
-static void vradio__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2)
-{
-    if (sh->h_dragon && sh->h_scale)
-    {
-        t_vradio *x = (t_vradio *)(sh->h_master);
-        int dx = (int)f1, dy = (int)f2;
-        dy = maxi(dy,(IEM_GUI_MINSIZE-x->x_gui.x_h)*x->x_number);
-        dx = dy/x->x_number;
-        sh->h_dragx = dx;
-        sh->h_dragy = dy;
-        scalehandle_drag_scale(sh);
-
-        int properties = gfxstub_haveproperties((void *)x);
-        if (properties)
-        {
-            int new_w = x->x_gui.x_h + sh->h_dragy;
-            properties_set_field_int(properties,"dim.w_ent",new_w);
-        }
-    }
-    scalehandle_dragon_label(sh,f1,f2);
-}
-
-void vradio_draw(t_vradio *x, t_glist *glist, int mode)
-{
-    if(mode == IEM_GUI_DRAW_MODE_UPDATE)
-        sys_queuegui(x, glist, vradio_draw_update);
-    else if(mode == IEM_GUI_DRAW_MODE_MOVE)
-        vradio_draw_move(x, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_NEW)
-    {
-        vradio_draw_new(x, glist);
-        sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
-    }
-    else if(mode == IEM_GUI_DRAW_MODE_SELECT)
-        vradio_draw_select(x, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_ERASE)
-        iemgui_draw_erase(&x->x_gui, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_CONFIG)
-        vradio_draw_config(x, glist);
-    else if(mode >= IEM_GUI_DRAW_MODE_IO)
-        vradio_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO);
-}
-
-/* ------------------------ vdl widgetbehaviour----------------------------- */
-
-static void vradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1,
-    int *xp2, int *yp2)
-{
-    t_vradio *x = (t_vradio *)z;
-
-    *xp1 = text_xpix(&x->x_gui.x_obj, glist);
-    *yp1 = text_ypix(&x->x_gui.x_obj, glist);
-    *xp2 = *xp1 + x->x_gui.x_w;
-    *yp2 = *yp1 + x->x_gui.x_h*x->x_number;
-
-    iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
-}
-
-static void vradio_save(t_gobj *z, t_binbuf *b)
-{
-    t_vradio *x = (t_vradio *)z;
-    int bflcol[3];
-    t_symbol *srl[3];
-
-    iemgui_save(&x->x_gui, srl, bflcol);
-    binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"),
-                (int)x->x_gui.x_obj.te_xpix,
-                (int)x->x_gui.x_obj.te_ypix,
-                (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class ?
-                    gensym("vdl") : gensym("vradio")),
-                x->x_gui.x_w,
-                x->x_change, iem_symargstoint(&x->x_gui), x->x_number,
-                srl[0], srl[1], srl[2],
-                x->x_gui.x_ldx, x->x_gui.x_ldy,
-                iem_fstyletoint(&x->x_gui), x->x_gui.x_fontsize,
-                bflcol[0], bflcol[1], bflcol[2], x->x_on);
-    binbuf_addv(b, ";");
-}
-
-static void vradio_properties(t_gobj *z, t_glist *owner)
-{
-    t_vradio *x = (t_vradio *)z;
-    char buf[800];
-    t_symbol *srl[3];
-    int hchange=-1;
-
-    iemgui_properties(&x->x_gui, srl);
-    if(pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class)
-        hchange = x->x_change;
-    sprintf(buf, "pdtk_iemgui_dialog %%s |vradio| \
-            ----------dimensions(pix):----------- %d %d size: 0 0 empty \
-            empty 0.0 empty 0.0 empty %d \
-            %d new-only new&old %d %d number: %d \
-            {%s} {%s} \
-            {%s} %d %d \
-            %d %d \
-            %d %d %d\n",
-            x->x_gui.x_w, IEM_GUI_MINSIZE,
-            0,/*no_schedule*/
-            hchange, x->x_gui.x_loadinit, -1, x->x_number,
-            srl[0]->s_name, srl[1]->s_name,
-            srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
-            x->x_gui.x_font_style, x->x_gui.x_fontsize,
-            0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol,
-            0xffffff & x->x_gui.x_lcol);
-    gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
-}
-
-static void vradio_dialog(t_vradio *x, t_symbol *s, int argc, t_atom *argv)
-{
-    canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
-
-    t_symbol *srl[3];
-    int a = (int)atom_getintarg(0, argc, argv);
-    int chg = (int)atom_getintarg(4, argc, argv);
-    int num = (int)atom_getintarg(6, argc, argv);
-    int sr_flags;
-
-    if(chg != 0) chg = 1;
-    x->x_change = chg;
-    sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
-    x->x_gui.x_w = iemgui_clip_size(a);
-    x->x_gui.x_h = x->x_gui.x_w;
-    if(x->x_number != num)
-    {
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
-        x->x_number = num;
-        if(x->x_on >= x->x_number)
-        {
-            x->x_on = x->x_number - 1;
-            x->x_on_old = x->x_on;
-        }
-        //(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
-        iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_NEW);
-    }
-    else
-    {
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
-        //(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
-        //canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
-        iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
-    }
-    if (x->x_gui.x_selected) vradio_draw_select(x, x->x_gui.x_glist);
-    scrollbar_update(x->x_gui.x_glist);
-}
-
-static void vradio_set(t_vradio *x, t_floatarg f)
-{
-    int i=(int)f;
-    int old;
-
-    if(i < 0)
-        i = 0;
-    if(i >= x->x_number)
-        i = x->x_number-1;
-    if(x->x_on != x->x_on_old)
-    {
-        old = x->x_on_old;
-        x->x_on_old = x->x_on;
-        x->x_on = i;
-        if (x->x_on != x->x_on_old)
-            (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        x->x_on_old = old;
-    }
-    else
-    {
-        x->x_on = i;
-        if (x->x_on != x->x_on_old)
-            (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-    }
-}
-
-static void vradio_bang(t_vradio *x)
-{
-        /* compatibility with earlier  "vdial" behavior */
-    if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class)
-    {
-        if((x->x_change)&&(x->x_on != x->x_on_old))
-        {
-            SETFLOAT(x->x_at, (t_float)x->x_on_old);
-            SETFLOAT(x->x_at+1, 0.0);
-            outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-                pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-        }
-        x->x_on_old = x->x_on;
-        SETFLOAT(x->x_at, (t_float)x->x_on);
-        SETFLOAT(x->x_at+1, 1.0);
-        outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-            pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-    }
-    else
-    {
-        outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
-        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-            pd_float(x->x_gui.x_snd->s_thing, x->x_on);
-    }
-}
-
-static void vradio_fout(t_vradio *x, t_floatarg f)
-{
-    int i=(int)f;
-
-    if(i < 0)
-        i = 0;
-    if(i >= x->x_number)
-        i = x->x_number-1;
-
-    if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class)
-    {
-            /* compatibility with earlier  "vdial" behavior */
-        if((x->x_change)&&(i != x->x_on_old))
-        {
-            SETFLOAT(x->x_at, (t_float)x->x_on_old);
-            SETFLOAT(x->x_at+1, 0.0);
-            outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-                pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-        }
-        if(x->x_on != x->x_on_old)
-            x->x_on_old = x->x_on;
-        x->x_on = i;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        x->x_on_old = x->x_on;
-        SETFLOAT(x->x_at, (t_float)x->x_on);
-        SETFLOAT(x->x_at+1, 1.0);
-        outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-        if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-            pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-    }
-    else
-    {
-        x->x_on_old = x->x_on;
-        x->x_on = i;
-        if (x->x_on != x->x_on_old)
-            (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
-        if (iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-            pd_float(x->x_gui.x_snd->s_thing, x->x_on);
-    }
-}
-
-static void vradio_float(t_vradio *x, t_floatarg f)
-{
-    int i=(int)f;
-
-    if(i < 0)
-        i = 0;
-    if(i >= x->x_number)
-        i = x->x_number-1;
-
-    if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class)
-    {
-            /* compatibility with earlier  "vdial" behavior */
-        if((x->x_change)&&(i != x->x_on_old))
-        {
-            if(x->x_gui.x_put_in2out)
-            {
-                SETFLOAT(x->x_at, (t_float)x->x_on_old);
-                SETFLOAT(x->x_at+1, 0.0);
-                outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-                if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-                    pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-            }
-        }
-        if(x->x_on != x->x_on_old)
-            x->x_on_old = x->x_on;
-        x->x_on = i;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        x->x_on_old = x->x_on;
-        if(x->x_gui.x_put_in2out)
-        {
-            SETFLOAT(x->x_at, (t_float)x->x_on);
-            SETFLOAT(x->x_at+1, 1.0);
-            outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
-            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-                pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
-        }
-    }
-    else
-    {
-        x->x_on_old = x->x_on;
-        x->x_on = i;
-        if (x->x_on != x->x_on_old)
-            (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        if (x->x_gui.x_put_in2out)
-        {
-            outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
-            if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-                pd_float(x->x_gui.x_snd->s_thing, x->x_on);
-        }
-    }
-}
-
-static void vradio_click(t_vradio *x, t_floatarg xpos, t_floatarg ypos,
-    t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
-{
-    int yy =  (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
-
-    vradio_fout(x, (t_float)(yy / x->x_gui.x_h));
-}
-
-static int vradio_newclick(t_gobj *z, struct _glist *glist,
-    int xpix, int ypix, int shift, int alt, int dbl, int doit)
-{
-    if(doit)
-        vradio_click((t_vradio *)z, (t_floatarg)xpix, (t_floatarg)ypix,
-            (t_floatarg)shift, 0, (t_floatarg)alt);
-    return (1);
-}
-
-static void vradio_loadbang(t_vradio *x)
-{
-    if(!sys_noloadbang && x->x_gui.x_loadinit)
-        vradio_bang(x);
-}
-
-static void vradio_number(t_vradio *x, t_floatarg num)
-{
-    int n=(int)num;
-
-    if(n < 1)
-        n = 1;
-    if(n > IEM_RADIO_MAX)
-        n = IEM_RADIO_MAX;
-    if(n != x->x_number)
-    {
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
-        x->x_number = n;
-        if(x->x_on >= x->x_number)
-            x->x_on = x->x_number - 1;
-        x->x_on_old = x->x_on;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
-    }
-}
-
-static void vradio_size(t_vradio *x, t_symbol *s, int ac, t_atom *av)
-{
-    x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
-    x->x_gui.x_h = x->x_gui.x_w;
-    iemgui_size(&x->x_gui);
-}
-
-static void vradio_init(t_vradio *x, t_floatarg f)
-{
-    x->x_gui.x_loadinit = (f==0.0)?0:1;
-}
-
-static void vradio_double_change(t_vradio *x)
-{x->x_change = 1;}
-
-static void vradio_single_change(t_vradio *x)
-{x->x_change = 0;}
-
-static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
-{
-    t_vradio *x = (t_vradio *)pd_new(old? vradio_old_class : vradio_class);
-    int bflcol[]={-262144, -1, -1};
-    int a=IEM_GUI_DEFAULTSIZE, on=0;
-    int ldx=0, ldy=-8, chg=1, num=8;
-    int fs=10;
-
-    if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2)
-       &&IS_A_FLOAT(argv,3)
-       &&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4))
-       &&(IS_A_SYMBOL(argv,5)||IS_A_FLOAT(argv,5))
-       &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6))
-       &&IS_A_FLOAT(argv,7)&&IS_A_FLOAT(argv,8)
-       &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10)&&IS_A_FLOAT(argv,11)
-       &&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13)&&IS_A_FLOAT(argv,14))
-    {
-        a = (int)atom_getintarg(0, argc, argv);
-        chg = (int)atom_getintarg(1, argc, argv);
-        iem_inttosymargs(&x->x_gui, atom_getintarg(2, argc, argv));
-        num = (int)atom_getintarg(3, argc, argv);
-        iemgui_new_getnames(&x->x_gui, 4, argv);
-        ldx = (int)atom_getintarg(7, argc, argv);
-        ldy = (int)atom_getintarg(8, argc, argv);
-        iem_inttofstyle(&x->x_gui, atom_getintarg(9, argc, argv));
-        fs = (int)atom_getintarg(10, argc, argv);
-        bflcol[0] = (int)atom_getintarg(11, argc, argv);
-        bflcol[1] = (int)atom_getintarg(12, argc, argv);
-        bflcol[2] = (int)atom_getintarg(13, argc, argv);
-        on = (int)atom_getintarg(14, argc, argv);
-    }
-    else iemgui_new_getnames(&x->x_gui, 4, 0);
-    x->x_gui.x_draw = (t_iemfunptr)vradio_draw;
-    x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
-    if (x->x_gui.x_font_style<0 || x->x_gui.x_font_style>2) x->x_gui.x_font_style=0;
-    if(num < 1)
-        num = 1;
-    if(num > IEM_RADIO_MAX)
-        num = IEM_RADIO_MAX;
-    x->x_number = num;
-    if(on < 0)
-        on = 0;
-    if(on >= x->x_number)
-        on = x->x_number - 1;
-    if(x->x_gui.x_loadinit)
-        x->x_on = on;
-    else
-        x->x_on = 0;
-    x->x_on_old = x->x_on;
-    x->x_change = (chg==0)?0:1;
-    if (iemgui_has_rcv(&x->x_gui))
-        pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
-    x->x_gui.x_ldx = ldx;
-    x->x_gui.x_ldy = ldy;
-    if(fs < 4)
-        fs = 4;
-    x->x_gui.x_fontsize = fs;
-    x->x_gui.x_w = iemgui_clip_size(a);
-    x->x_gui.x_h = x->x_gui.x_w;
-    iemgui_verify_snd_ne_rcv(&x->x_gui);
-    iemgui_all_colfromload(&x->x_gui, bflcol);
-    outlet_new(&x->x_gui.x_obj, &s_list);
-
-    x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_iemgui *)x,1);
-    x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_iemgui *)x,0);
-    x->x_gui.x_obj.te_iemgui = 1;
-
-    return (x);
-}
-
-static void *vradio_new(t_symbol *s, int argc, t_atom *argv)
-{
-    return (vradio_donew(s, argc, argv, 0));
-}
-
-static void *vdial_new(t_symbol *s, int argc, t_atom *argv)
-{
-    return (vradio_donew(s, argc, argv, 1));
-}
-
-static void vradio_ff(t_vradio *x)
-{
-    if(iemgui_has_rcv(&x->x_gui))
-        pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
-    gfxstub_deleteforkey(x);
-
-    if (x->x_gui. x_handle) scalehandle_free(x->x_gui. x_handle);
-    if (x->x_gui.x_lhandle) scalehandle_free(x->x_gui.x_lhandle);
-}
-
-void g_vradio_setup(void)
-{
-    vradio_class = class_new(gensym("vradio"), (t_newmethod)vradio_new,
-        (t_method)vradio_ff, sizeof(t_vradio), 0, A_GIMME, 0);
-    class_addbang(vradio_class, vradio_bang);
-    class_addfloat(vradio_class, vradio_float);
-    class_addmethod(vradio_class, (t_method)vradio_click, gensym("click"),
-                    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
-    class_addmethod(vradio_class, (t_method)vradio_dialog, gensym("dialog"),
-                    A_GIMME, 0);
-    class_addmethod(vradio_class, (t_method)vradio_loadbang,
-        gensym("loadbang"), 0);
-    class_addmethod(vradio_class, (t_method)vradio_set,
-        gensym("set"), A_FLOAT, 0);
-    class_addmethod(vradio_class, (t_method)vradio_size,
-        gensym("size"), A_GIMME, 0);
-    iemgui_class_addmethods(vradio_class);
-    class_addmethod(vradio_class, (t_method)vradio_init,
-        gensym("init"), A_FLOAT, 0);
-    class_addmethod(vradio_class, (t_method)vradio_number,
-        gensym("number"), A_FLOAT, 0);
-    class_addmethod(vradio_class, (t_method)vradio_single_change,
-        gensym("single_change"), 0);
-    class_addmethod(vradio_class, (t_method)vradio_double_change,
-        gensym("double_change"), 0);
- 
-    scalehandle_class = class_new(gensym("_scalehandle"), 0, 0,
-                  sizeof(t_scalehandle), CLASS_PD, 0);
-    class_addmethod(scalehandle_class, (t_method)vradio__clickhook,
-            gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
-    class_addmethod(scalehandle_class, (t_method)vradio__motionhook,
-            gensym("_motion"), A_FLOAT, A_FLOAT, 0);
-
-    wb_init(&vradio_widgetbehavior,vradio_getrect,vradio_newclick);
-    class_setwidget(vradio_class, &vradio_widgetbehavior);
-    class_sethelpsymbol(vradio_class, gensym("vradio"));
-    class_setsavefn(vradio_class, vradio_save);
-    class_setpropertiesfn(vradio_class, vradio_properties);
-
-        /* obsolete version (0.34-0.35) */
-    vradio_old_class = class_new(gensym("vdl"), (t_newmethod)vdial_new,
-        (t_method)vradio_ff, sizeof(t_vradio), 0, A_GIMME, 0);
-    class_addbang(vradio_old_class, vradio_bang);
-    class_addfloat(vradio_old_class, vradio_float);
-    class_addmethod(vradio_old_class, (t_method)vradio_click, gensym("click"),
-                    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
-    class_addmethod(vradio_old_class, (t_method)vradio_dialog,
-        gensym("dialog"), A_GIMME, 0);
-    class_addmethod(vradio_old_class, (t_method)vradio_loadbang,
-        gensym("loadbang"), 0);
-    class_addmethod(vradio_old_class, (t_method)vradio_set,
-        gensym("set"), A_FLOAT, 0);
-    class_addmethod(vradio_old_class, (t_method)vradio_size,
-        gensym("size"), A_GIMME, 0);
-    iemgui_class_addmethods(vradio_old_class);
-    class_addmethod(vradio_old_class, (t_method)vradio_init,
-        gensym("init"), A_FLOAT, 0);
-    class_addmethod(vradio_old_class, (t_method)vradio_number,
-        gensym("number"), A_FLOAT, 0);
-    class_addmethod(vradio_old_class, (t_method)vradio_single_change,
-        gensym("single_change"), 0);
-    class_addmethod(vradio_old_class, (t_method)vradio_double_change,
-        gensym("double_change"), 0);
-    class_setwidget(vradio_old_class, &vradio_widgetbehavior);
-    class_sethelpsymbol(vradio_old_class, gensym("vradio"));
-}
diff --git a/pd/src/g_vslider.c b/pd/src/g_vslider.c
index 069726540311fe89628a08fca5cbd7fdf3655a2e..8b137891791fe96927ad78e64b0aad7bded08bdc 100644
--- a/pd/src/g_vslider.c
+++ b/pd/src/g_vslider.c
@@ -1,666 +1 @@
-/* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
 
-/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
-/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include "m_pd.h"
-#include "g_canvas.h"
-#include "t_tk.h"
-#include "g_all_guis.h"
-#include <math.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_IO_H
-#include <io.h>
-#endif
-
-extern int gfxstub_haveproperties(void *key);
-static void vslider_draw_select(t_vslider* x, t_glist* glist);
-
-/* ------------ vsl gui-vertical  slider ----------------------- */
-
-t_widgetbehavior vslider_widgetbehavior;
-static t_class *vslider_class;
-
-/* widget helper functions */
-
-static void vslider_draw_update(t_gobj *client, t_glist *glist)
-{
-    t_vslider *x = (t_vslider *)client;
-    if (!x->x_gui.x_changed) return;
-    x->x_gui.x_changed = 0;
-    t_canvas *canvas=glist_getcanvas(glist);
-    if (!glist_isvisible(glist)) return;
-    int r = text_ypix(&x->x_gui.x_obj, glist) + 2 + x->x_gui.x_h - (x->x_val + 50)/100;
-    int x1=text_xpix(&x->x_gui.x_obj, glist), x2=x1+x->x_gui.x_w;
-    sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n",
-        canvas, x, x1+2, r, x2-2, r);
-    int t = x->x_thick;
-    x->x_thick = x->x_val == x->x_center;
-    if (t!=x->x_thick)
-        sys_vgui(".x%lx.c itemconfigure %lxKNOB -strokewidth %d\n",
-            canvas, x, 4*x->x_thick+3);
-}
-
-static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    iemgui_io_draw(&x->x_gui,canvas,old_snd_rcv_flags);
-}
-
-static void vslider_draw_new(t_vslider *x, t_glist *glist)
-{
-    int xpos=text_xpix(&x->x_gui.x_obj, glist);
-    int ypos=text_ypix(&x->x_gui.x_obj, glist);
-    int r = ypos + 2 + x->x_gui.x_h - (x->x_val + 50)/100;
-    t_canvas *canvas=glist_getcanvas(glist);
-
-    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-    iemgui_base_draw_new(&x->x_gui, canvas, nlet_tag);
-    scalehandle_draw_new(x->x_gui. x_handle,canvas);
-    scalehandle_draw_new(x->x_gui.x_lhandle,canvas);
-
-    sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 "
-        "-stroke #%6.6x -tags {%lxKNOB %lxOBJ %s text iemgui}\n",
-        canvas, xpos+2, r,
-        xpos + x->x_gui.x_w-2, r, x->x_gui.x_fcol, x, x, nlet_tag);
-        iemgui_label_draw_new(&x->x_gui,canvas,xpos,ypos,nlet_tag);
-    vslider_draw_io(x,glist,7);
-}
-
-static void vslider_draw_move(t_vslider *x, t_glist *glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    if (!glist_isvisible(canvas)) return;
-    int xpos=text_xpix(&x->x_gui.x_obj, glist);
-    int ypos=text_ypix(&x->x_gui.x_obj, glist);
-    int r = ypos + 2 + x->x_gui.x_h - (x->x_val + 50)/100;
-
-    char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-    sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n",
-        canvas, x, xpos, ypos, xpos + x->x_gui.x_w, ypos + x->x_gui.x_h+5);
-    sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n",
-        canvas, x, xpos+2, r, xpos + x->x_gui.x_w-2, r);
-    iemgui_label_draw_move(&x->x_gui,canvas,xpos,ypos);
-    iemgui_io_draw_move(&x->x_gui,canvas,nlet_tag);
-    if (x->x_gui.x_selected) vslider_draw_select(x, x->x_gui.x_glist);
-}
-
-static void vslider_draw_config(t_vslider* x,t_glist* glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    iemgui_label_draw_config(&x->x_gui,canvas);
-    iemgui_base_draw_config(&x->x_gui,canvas);
-    sys_vgui(".x%lx.c itemconfigure %lxKNOB -stroke #%6.6x\n",
-         canvas, x, x->x_gui.x_fcol);
-}
-
-static void vslider_draw_select(t_vslider *x, t_glist *glist)
-{
-    t_canvas *canvas=glist_getcanvas(glist);
-    iemgui_base_draw_config(&x->x_gui,canvas);
-    if(x->x_gui.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))
-        {
-            scalehandle_draw_select2(&x->x_gui,glist,
-                x->x_gui.x_w-1,x->x_gui.x_h+5-1);
-        }
-    }
-    else
-    {
-        scalehandle_draw_erase2(&x->x_gui,glist);
-    }
-    iemgui_label_draw_select(&x->x_gui,canvas);
-    iemgui_tag_selected(&x->x_gui,canvas);
-}
-
-void vslider_check_minmax(t_vslider *x, double min, double max);
-void vslider_check_height(t_vslider *x, int w);
-
-static void vslider__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx,
-    t_floatarg yyy)
-{
-    t_vslider *x = (t_vslider *)(sh->h_master);
-    int newstate = (int)f;
-    if (sh->h_dragon && newstate == 0 && sh->h_scale)
-    {
-        canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
-        if (sh->h_dragx || sh->h_dragy)
-        {
-            double height_change_ratio = (double)(x->x_gui.x_h + sh->h_dragy)
-                /(double)x->x_gui.x_h;
-            x->x_val = x->x_val * height_change_ratio;
-            x->x_gui.x_w += sh->h_dragx;
-            vslider_check_height(x, x->x_gui.x_h + sh->h_dragy);
-            vslider_check_minmax(x, x->x_min, x->x_max);
-            canvas_dirty(x->x_gui.x_glist, 1);
-        }
-        if (glist_isvisible(x->x_gui.x_glist))
-        {
-            vslider_draw_move(x, x->x_gui.x_glist);
-            scalehandle_unclick_scale(sh);
-        }
-    }
-    else if (!sh->h_dragon && newstate && sh->h_scale)
-    {
-        scalehandle_click_scale(sh);
-    }
-    else if (sh->h_dragon && newstate == 0 && !sh->h_scale)
-    {
-        scalehandle_unclick_label(sh);
-    }
-    else if (!sh->h_dragon && newstate && !sh->h_scale)
-    {
-        scalehandle_click_label(sh);
-    }
-    sh->h_dragon = newstate;
-}
-
-static void vslider__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2)
-{
-    if (sh->h_dragon && sh->h_scale)
-    {
-        t_vslider *x = (t_vslider *)(sh->h_master);
-        int dx = (int)f1, dy = (int)f2;
-        dx = maxi(dx,IEM_GUI_MINSIZE-x->x_gui.x_w);
-        dy = maxi(dy, IEM_SL_MINSIZE-x->x_gui.x_h);
-        sh->h_dragx = dx;
-        sh->h_dragy = dy;
-        scalehandle_drag_scale(sh);
-
-        int properties = gfxstub_haveproperties((void *)x);
-        if (properties)
-        {
-            int new_w = x->x_gui.x_w + sh->h_dragx;
-            int new_h = x->x_gui.x_h + sh->h_dragy;
-            properties_set_field_int(properties,"dim.w_ent",new_w);
-            properties_set_field_int(properties,"dim.h_ent",new_h);
-        }
-    }
-    scalehandle_dragon_label(sh,f1,f2);
-}
-
-void vslider_draw(t_vslider *x, t_glist *glist, int mode)
-{
-    if(mode == IEM_GUI_DRAW_MODE_UPDATE)
-        sys_queuegui(x, glist, vslider_draw_update);
-    else if(mode == IEM_GUI_DRAW_MODE_MOVE)
-        vslider_draw_move(x, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_NEW)
-    {
-        vslider_draw_new(x, glist);
-        sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
-    }
-    else if(mode == IEM_GUI_DRAW_MODE_SELECT)
-        vslider_draw_select(x, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_ERASE)
-        iemgui_draw_erase(&x->x_gui, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_CONFIG)
-        vslider_draw_config(x, glist);
-    else if(mode >= IEM_GUI_DRAW_MODE_IO)
-        vslider_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO);
-}
-
-/* ------------------------ vsl widgetbehaviour----------------------------- */
-
-static void vslider_getrect(t_gobj *z, t_glist *glist,
-                            int *xp1, int *yp1, int *xp2, int *yp2)
-{
-    t_vslider* x = (t_vslider*)z;
-
-    *xp1 = text_xpix(&x->x_gui.x_obj, glist);
-    *yp1 = text_ypix(&x->x_gui.x_obj, glist);
-    *xp2 = *xp1 + x->x_gui.x_w;
-    *yp2 = *yp1 + x->x_gui.x_h + 5;
-
-    iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
-}
-
-static void vslider_save(t_gobj *z, t_binbuf *b)
-{
-    t_vslider *x = (t_vslider *)z;
-    int bflcol[3];
-    t_symbol *srl[3];
-
-    iemgui_save(&x->x_gui, srl, bflcol);
-    binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"),
-                (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
-                gensym("vsl"), x->x_gui.x_w, x->x_gui.x_h,
-                (t_float)x->x_min, (t_float)x->x_max,
-                x->x_lin0_log1, iem_symargstoint(&x->x_gui),
-                srl[0], srl[1], srl[2],
-                x->x_gui.x_ldx, x->x_gui.x_ldy,
-                iem_fstyletoint(&x->x_gui), x->x_gui.x_fontsize,
-                bflcol[0], bflcol[1], bflcol[2],
-                x->x_val, x->x_steady);
-    binbuf_addv(b, ";");
-}
-
-void vslider_check_height(t_vslider *x, int h)
-{
-    if(h < IEM_SL_MINSIZE)
-        h = IEM_SL_MINSIZE;
-    x->x_gui.x_h = h;
-    x->x_center = (x->x_gui.x_h-1)*50;
-    if(x->x_val > (x->x_gui.x_h*100 - 100))
-    {
-        x->x_pos = x->x_gui.x_h*100 - 100;
-        x->x_val = x->x_pos;
-    }
-    if(x->x_lin0_log1)
-        x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_h - 1);
-    else
-        x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_h - 1);
-}
-
-void vslider_check_minmax(t_vslider *x, double min, double max)
-{
-    if(x->x_lin0_log1)
-    {
-        if((min == 0.0)&&(max == 0.0))
-            max = 1.0;
-        if(max > 0.0)
-        {
-            if(min <= 0.0)
-                min = 0.01*max;
-        }
-        else
-        {
-            if(min > 0.0)
-                max = 0.01*min;
-        }
-    }
-    x->x_min = min;
-    x->x_max = max;
-    if(x->x_min > x->x_max)                /* bugfix */
-        x->x_gui.x_reverse = 1;
-    else
-        x->x_gui.x_reverse = 0;
-    if(x->x_lin0_log1)
-        x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_h - 1);
-    else
-        x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_h - 1);
-}
-
-static void vslider_properties(t_gobj *z, t_glist *owner)
-{
-    t_vslider *x = (t_vslider *)z;
-    char buf[800];
-    t_symbol *srl[3];
-
-    iemgui_properties(&x->x_gui, srl);
-
-    sprintf(buf, "pdtk_iemgui_dialog %%s |vsl| \
-            --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \
-            -----------output-range:----------- %g bottom: %g top: %d \
-            %d lin log %d %d empty %d \
-            {%s} {%s} \
-            {%s} %d %d \
-            %d %d \
-            %d %d %d\n",
-            x->x_gui.x_w, IEM_GUI_MINSIZE, x->x_gui.x_h, IEM_SL_MINSIZE,
-            x->x_min, x->x_max, 0,/*no_schedule*/
-            x->x_lin0_log1, x->x_gui.x_loadinit, x->x_steady, -1,/*no multi, but iem-characteristic*/
-            srl[0]->s_name, srl[1]->s_name,
-            srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
-            x->x_gui.x_font_style, x->x_gui.x_fontsize,
-            0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol,
-            0xffffff & x->x_gui.x_lcol);
-    gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
-}
-
-static void vslider_bang(t_vslider *x)
-{
-    double out;
-
-    if(x->x_lin0_log1)
-        out = x->x_min*exp(x->x_k*(double)(x->x_val)*0.01);
-    else
-        if (x->x_is_last_float && x->x_last <= x->x_max &&
-            x->x_last >= x->x_min)
-            out = x->x_last;
-        else
-            out = (double)(x->x_val)*0.01*x->x_k + x->x_min;
-    if((out < 1.0e-10)&&(out > -1.0e-10))
-        out = 0.0;
-
-    outlet_float(x->x_gui.x_obj.ob_outlet, out);
-    if(iemgui_has_snd(&x->x_gui) && x->x_gui.x_snd->s_thing)
-        pd_float(x->x_gui.x_snd->s_thing, out);
-}
-
-static void vslider_dialog(t_vslider *x, t_symbol *s, int argc, t_atom *argv)
-{
-    canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
-
-    t_symbol *srl[3];
-    int w = (int)atom_getintarg(0, argc, argv);
-    int h = (int)atom_getintarg(1, argc, argv);
-    double min = (double)atom_getfloatarg(2, argc, argv);
-    double max = (double)atom_getfloatarg(3, argc, argv);
-    int lilo = (int)atom_getintarg(4, argc, argv);
-    int steady = (int)atom_getintarg(17, argc, argv);
-    int sr_flags;
-
-    if(lilo != 0) lilo = 1;
-    x->x_lin0_log1 = lilo;
-    if(steady)
-        x->x_steady = 1;
-    else
-        x->x_steady = 0;
-    sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
-    x->x_gui.x_w = iemgui_clip_size(w);
-    int old_height = x->x_gui.x_h;
-    vslider_check_height(x, h);
-    if (x->x_gui.x_h != old_height)
-    {
-        x->x_val = x->x_val * ((double)x->x_gui.x_h/(double)old_height);
-    }
-    vslider_check_minmax(x, min, max);
-    (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
-    (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
-    //(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
-    //canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
-    iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
-
-    if (x->x_gui.x_selected) vslider_draw_select(x, x->x_gui.x_glist);
-    scrollbar_update(x->x_gui.x_glist);
-}
-
-static void vslider_motion(t_vslider *x, t_floatarg dx, t_floatarg dy)
-{
-    x->x_is_last_float = 0;
-    int old = x->x_val;
-
-    if(x->x_gui.x_finemoved)
-        x->x_pos -= (int)dy;
-    else
-        x->x_pos -= 100*(int)dy;
-    x->x_val = x->x_pos;
-    if(x->x_val > (100*x->x_gui.x_h - 100))
-    {
-        x->x_val = 100*x->x_gui.x_h - 100;
-        x->x_pos += 50;
-        x->x_pos -= x->x_pos%100;
-    }
-    if(x->x_val < 0)
-    {
-        x->x_val = 0;
-        x->x_pos -= 50;
-        x->x_pos -= x->x_pos%100;
-    }
-    if(old != x->x_val)
-    {
-        x->x_gui.x_changed = 1;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        vslider_bang(x);
-    }
-}
-
-static void vslider_click(t_vslider *x, t_floatarg xpos, t_floatarg ypos,
-    t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
-{
-    if(!x->x_steady)
-        x->x_val = (int)(100.0 * (x->x_gui.x_h +
-            text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist) - ypos));
-    if(x->x_val > (100*x->x_gui.x_h - 100))
-        x->x_val = 100*x->x_gui.x_h - 100;
-    if(x->x_val < 0)
-        x->x_val = 0;
-    if (x->x_pos != x->x_val)
-    {
-        x->x_pos = x->x_val;
-        x->x_gui.x_changed = 1;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-    }
-    vslider_bang(x);
-    glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g,
-        (t_glistmotionfn)vslider_motion, 0, xpos, ypos);
-}
-
-static int vslider_newclick(t_gobj *z, struct _glist *glist,
-    int xpix, int ypix, int shift, int alt, int dbl, int doit)
-{
-    t_vslider* x = (t_vslider *)z;
-
-    if(doit)
-    {
-        vslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift,
-            0, (t_floatarg)alt);
-        if(shift)
-            x->x_gui.x_finemoved = 1;
-        else
-            x->x_gui.x_finemoved = 0;
-    }
-    return (1);
-}
-
-static void vslider_set(t_vslider *x, t_floatarg f)
-{
-    double g;
-
-    if(x->x_gui.x_reverse)    /* bugfix */
-    {
-        if(f > x->x_min)
-            f = x->x_min;
-        if(f < x->x_max)
-            f = x->x_max;
-    }
-    else
-    {
-        if(f > x->x_max)
-            f = x->x_max;
-        if(f < x->x_min)
-            f = x->x_min;
-    }
-    if(x->x_lin0_log1)
-        g = log(f/x->x_min)/x->x_k;
-    else
-        g = (f - x->x_min) / x->x_k;
-    x->x_val = (int)(100.0*g + 0.49999);
-    if(x->x_pos != x->x_val)
-    {
-        x->x_pos = x->x_val;
-        x->x_gui.x_changed = 1;
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-    }
-}
-
-static void vslider_float(t_vslider *x, t_floatarg f)
-{
-    x->x_is_last_float = 1;
-    x->x_last = f;
-    vslider_set(x, f);
-    if(x->x_gui.x_put_in2out)
-        vslider_bang(x);
-}
-
-static void vslider_size(t_vslider *x, t_symbol *s, int ac, t_atom *av)
-{
-    x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
-    if(ac > 1)
-        vslider_check_height(x, (int)atom_getintarg(1, ac, av));
-    iemgui_size(&x->x_gui);
-}
-
-static void vslider_range(t_vslider *x, t_symbol *s, int ac, t_atom *av)
-{
-    vslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av),
-                         (double)atom_getfloatarg(1, ac, av));
-}
-
-static void vslider_log(t_vslider *x)
-{
-    x->x_lin0_log1 = 1;
-    vslider_check_minmax(x, x->x_min, x->x_max);
-}
-
-static void vslider_lin(t_vslider *x)
-{
-    x->x_lin0_log1 = 0;
-    x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_h - 1);
-}
-
-static void vslider_init(t_vslider *x, t_floatarg f)
-{
-    x->x_gui.x_loadinit = (f==0.0)?0:1;
-}
-
-static void vslider_steady(t_vslider *x, t_floatarg f)
-{
-    x->x_steady = (f==0.0)?0:1;
-}
-
-static void vslider_loadbang(t_vslider *x)
-{
-    if(!sys_noloadbang && x->x_gui.x_loadinit)
-    {
-        (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-        vslider_bang(x);
-    }
-}
-
-static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
-{
-    t_vslider *x = (t_vslider *)pd_new(vslider_class);
-    int bflcol[]={-262144, -1, -1};
-    int w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE;
-    int lilo=0, ldx=0, ldy=-9;
-    int fs=10, v=0, steady=1;
-    double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
-
-    iem_inttosymargs(&x->x_gui, 0);
-    iem_inttofstyle(&x->x_gui, 0);
-
-    if(((argc == 17)||(argc == 18))&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)
-       &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3)
-       &&IS_A_FLOAT(argv,4)&&IS_A_FLOAT(argv,5)
-       &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6))
-       &&(IS_A_SYMBOL(argv,7)||IS_A_FLOAT(argv,7))
-       &&(IS_A_SYMBOL(argv,8)||IS_A_FLOAT(argv,8))
-       &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10)
-       &&IS_A_FLOAT(argv,11)&&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13)
-       &&IS_A_FLOAT(argv,14)&&IS_A_FLOAT(argv,15)&&IS_A_FLOAT(argv,16))
-    {
-        w = (int)atom_getintarg(0, argc, argv);
-        h = (int)atom_getintarg(1, argc, argv);
-        min = (double)atom_getfloatarg(2, argc, argv);
-        max = (double)atom_getfloatarg(3, argc, argv);
-        lilo = (int)atom_getintarg(4, argc, argv);
-        iem_inttosymargs(&x->x_gui, atom_getintarg(5, argc, argv));
-        iemgui_new_getnames(&x->x_gui, 6, argv);
-        ldx = (int)atom_getintarg(9, argc, argv);
-        ldy = (int)atom_getintarg(10, argc, argv);
-        iem_inttofstyle(&x->x_gui, atom_getintarg(11, argc, argv));
-        fs = (int)atom_getintarg(12, argc, argv);
-        bflcol[0] = (int)atom_getintarg(13, argc, argv);
-        bflcol[1] = (int)atom_getintarg(14, argc, argv);
-        bflcol[2] = (int)atom_getintarg(15, argc, argv);
-        v = (int)atom_getintarg(16, argc, argv);
-    }
-    else iemgui_new_getnames(&x->x_gui, 6, 0);
-    if((argc == 18)&&IS_A_FLOAT(argv,17))
-        steady = (int)atom_getintarg(17, argc, argv);
-    x->x_gui.x_draw = (t_iemfunptr)vslider_draw;
-    x->x_is_last_float = 0;
-    x->x_last = 0.0;
-    x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
-    if(x->x_gui.x_loadinit)
-        x->x_val = v;
-    else
-        x->x_val = 0;
-    x->x_pos = x->x_val;
-    if(lilo != 0) lilo = 1;
-    x->x_lin0_log1 = lilo;
-    if(steady != 0) steady = 1;
-    x->x_steady = steady;
-    if (x->x_gui.x_font_style<0 || x->x_gui.x_font_style>2) x->x_gui.x_font_style=0;
-    if(iemgui_has_rcv(&x->x_gui))
-        pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
-    x->x_gui.x_ldx = ldx;
-    x->x_gui.x_ldy = ldy;
-    if(fs < 4)
-        fs = 4;
-    x->x_gui.x_fontsize = fs;
-    x->x_gui.x_w = iemgui_clip_size(w);
-    vslider_check_height(x, h);
-    vslider_check_minmax(x, min, max);
-    iemgui_all_colfromload(&x->x_gui, bflcol);
-    x->x_thick = 0;
-    iemgui_verify_snd_ne_rcv(&x->x_gui);
-    outlet_new(&x->x_gui.x_obj, &s_float);
-
-    x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_iemgui *)x,1);
-    x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_iemgui *)x,0);
-    x->x_gui.x_obj.te_iemgui = 1;
-    x->x_gui.x_changed = 0;
-
-    return (x);
-}
-
-static void vslider_free(t_vslider *x)
-{
-    if(iemgui_has_rcv(&x->x_gui))
-        pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
-    gfxstub_deleteforkey(x);
-
-    if (x->x_gui. x_handle) scalehandle_free(x->x_gui. x_handle);
-    if (x->x_gui.x_lhandle) scalehandle_free(x->x_gui.x_lhandle);
-}
-
-void g_vslider_setup(void)
-{
-    vslider_class = class_new(gensym("vsl"), (t_newmethod)vslider_new,
-                              (t_method)vslider_free, sizeof(t_vslider), 0, A_GIMME, 0);
-    class_addcreator((t_newmethod)vslider_new, gensym("vslider"), A_GIMME, 0);
-    class_addbang(vslider_class,vslider_bang);
-    class_addfloat(vslider_class,vslider_float);
-    class_addmethod(vslider_class, (t_method)vslider_click, gensym("click"),
-                    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
-    class_addmethod(vslider_class, (t_method)vslider_motion, gensym("motion"),
-                    A_FLOAT, A_FLOAT, 0);
-    class_addmethod(vslider_class, (t_method)vslider_dialog, gensym("dialog"),
-                    A_GIMME, 0);
-    class_addmethod(vslider_class, (t_method)vslider_loadbang,
-        gensym("loadbang"), 0);
-    class_addmethod(vslider_class, (t_method)vslider_set,
-        gensym("set"), A_FLOAT, 0);
-    class_addmethod(vslider_class, (t_method)vslider_size,
-        gensym("size"), A_GIMME, 0);
-    iemgui_class_addmethods(vslider_class);
-    class_addmethod(vslider_class, (t_method)vslider_range,
-        gensym("range"), A_GIMME, 0);
-    class_addmethod(vslider_class, (t_method)vslider_log, gensym("log"), 0);
-    class_addmethod(vslider_class, (t_method)vslider_lin, gensym("lin"), 0);
-    class_addmethod(vslider_class, (t_method)vslider_init,
-        gensym("init"), A_FLOAT, 0);
-    class_addmethod(vslider_class, (t_method)vslider_steady,
-        gensym("steady"), A_FLOAT, 0);
- 
-    scalehandle_class = class_new(gensym("_scalehandle"), 0, 0,
-                  sizeof(t_scalehandle), CLASS_PD, 0);
-    class_addmethod(scalehandle_class, (t_method)vslider__clickhook,
-            gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
-    class_addmethod(scalehandle_class, (t_method)vslider__motionhook,
-            gensym("_motion"), A_FLOAT, A_FLOAT, 0);
-
-    wb_init(&vslider_widgetbehavior,vslider_getrect,vslider_newclick);
-    class_setwidget(vslider_class, &vslider_widgetbehavior);
-    class_sethelpsymbol(vslider_class, gensym("vslider"));
-    class_setsavefn(vslider_class, vslider_save);
-    class_setpropertiesfn(vslider_class, vslider_properties);
-}
diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c
index bfce538ece449b40fbef7155d6d5e45e1510be39..9f10bf2326b0ff54c12a5db976e2372f2c9b9291 100644
--- a/pd/src/g_vumeter.c
+++ b/pd/src/g_vumeter.c
@@ -5,15 +5,11 @@
 /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
 /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
 
-#include "config.h"
-
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <ctype.h>
 #include "m_pd.h"
 #include "g_canvas.h"
-#include "t_tk.h"
 #include "g_all_guis.h"
 #include <math.h>
 
@@ -74,6 +70,7 @@ int iemgui_vu_col[]=
     15,15,15,15,15,15,15,15,15,15,14,14,13,13,13,13,13,13,13,13,13,13,13,19,19,19
 };
 
+static t_class *scalehandle_class;
 extern int gfxstub_haveproperties(void *key);
 static void vu_draw_select(t_vu* x, t_glist* glist);
 void vu_check_height(t_vu *x, int h);
@@ -267,7 +264,6 @@ static void vu_draw_config(t_vu* x, t_glist* glist)
 
 static void vu_draw_select(t_vu* x,t_glist* glist)
 {
-    int i;
     t_canvas *canvas=glist_getcanvas(glist);
     iemgui_base_draw_config(&x->x_gui,canvas);
     char lcol[8]; sprintf(lcol,"#%6.6x", x->x_gui.x_lcol);
@@ -309,18 +305,7 @@ static void vu__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx,
             scalehandle_unclick_scale(sh);
         }
     }
-    else if (!sh->h_dragon && newstate && sh->h_scale)
-    {
-        scalehandle_click_scale(sh);
-    }
-    else if (sh->h_dragon && newstate == 0 && !sh->h_scale)
-    {
-        scalehandle_unclick_label(sh);
-    }
-    else if (!sh->h_dragon && newstate && !sh->h_scale)
-    {
-        scalehandle_click_label(sh);
-    }
+    else iemgui__clickhook3(sh,newstate);
     sh->h_dragon = newstate;
 }
 
diff --git a/pd/src/makefile.in b/pd/src/makefile.in
index 4b64a1e5a495f1a77e9016aff76bc080a7c0a826..7b98733650cd94c9ff79691d60f9d58c12fa05fa 100644
--- a/pd/src/makefile.in
+++ b/pd/src/makefile.in
@@ -64,8 +64,8 @@ TYPE_PUNNING_SRC = d_ctl.c d_array.c d_delay.c d_filter.c d_math.c d_osc.c d_sou
 # these are safe for full gcc 4.x optimization
 OPT_SAFE_SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
     g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
-    g_undo.c g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \
-    g_toggle.c g_vdial.c g_vslider.c g_vumeter.c g_magicglass.c \
+    g_undo.c g_all_guis.c g_bang.c g_mycanvas.c g_numbox.c \
+    g_toggle.c g_vumeter.c g_magicglass.c g_radio.c g_slider.c \
     m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \
     m_conf.c m_glob.c m_sched.c \
     s_main.c s_inter.c s_file.c s_print.c \