diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c
index 5b4984eb9005136c540ae6062ead2c9b9d0d345c..580b1476c638fb9ea1bae83a1b21cdf028b5bf69 100644
--- a/pd/src/g_readwrite.c
+++ b/pd/src/g_readwrite.c
@@ -602,12 +602,13 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b)
     linetraverser_start(&t, x);
     while (oc = linetraverser_next(&t))
     {
-		if (outconnect_visible(oc)) {
-		    int srcno = canvas_getindex(x, &t.tr_ob->ob_g);
-		    int sinkno = canvas_getindex(x, &t.tr_ob2->ob_g);
-		    binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"),
-		        srcno, t.tr_outno, sinkno, t.tr_inno);
-		}
+        if (outconnect_visible(oc))
+        {
+            int srcno = canvas_getindex(x, &t.tr_ob->ob_g);
+            int sinkno = canvas_getindex(x, &t.tr_ob2->ob_g);
+            binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"),
+                srcno, t.tr_outno, sinkno, t.tr_inno);
+        }
     }
         /* unless everything is the default (as in ordinary subpatches)
         print out a "coords" message to set up the coordinate systems */
diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c
index 7e985850acb47be58dc07aa2e83dd8d24a2500ff..56aa0766ef2f753792f554c55ab23f3ee579a643 100644
--- a/pd/src/g_rtext.c
+++ b/pd/src/g_rtext.c
@@ -196,190 +196,209 @@ extern int sys_oldtclversion;
 static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
     int *indexp)
 {
-	//fprintf(stderr,"rtext_senditup <%s>\n", x->x_buf);
-	if (x) {
-		t_float dispx, dispy;
-		char smallbuf[200], *tempbuf;
-		int outchars_b = 0, nlines = 0, ncolumns = 0,
-		    pixwide, pixhigh, font, fontwidth, fontheight, findx, findy;
-		int reportedindex = 0;
-		t_canvas *canvas = glist_getcanvas(x->x_glist);
-		int widthspec_c = x->x_text->te_width; // width if any specified
-		int widthlimit_c = (widthspec_c ? widthspec_c : BOXWIDTH); // width limit in chars
-		//fprintf(stderr,"senditup widthlimit_c %d %d\n", widthspec_c, widthlimit_c);
-		int inindex_b = 0; // index location in the buffer
-		int inindex_c = 0; // index location in the u8 chars
-		int selstart_b = 0, selend_b = 0; // selection start and end
-		int x_bufsize_c = u8_charnum(x->x_buf, x->x_bufsize); // buffer size in u8 chars
-		    /* if we're a GOP (the new, "goprect" style) borrow the font size
-		    from the inside to preserve the spacing */
-		if (pd_class(&x->x_text->te_pd) == canvas_class &&
-		    ((t_glist *)(x->x_text))->gl_isgraph &&
-		    ((t_glist *)(x->x_text))->gl_goprect)
-		        font =  glist_getfont((t_glist *)(x->x_text));
-		else font = glist_getfont(x->x_glist);
-		fontwidth = sys_fontwidth(font);
-		fontheight = sys_fontheight(font);
-		findx = (*widthp + (fontwidth/2)) / fontwidth; // calculating x and y in pixels
-		findy = *heightp / fontheight;
-		if (x->x_bufsize >= 100)
-		     tempbuf = (char *)t_getbytes(2 * x->x_bufsize + 1);
-		else tempbuf = smallbuf;
-		while (x_bufsize_c - inindex_c > 0)
-		{
-			int inchars_b  = x->x_bufsize - inindex_b;
-			int inchars_c  = x_bufsize_c  - inindex_c;
-			int maxindex_c = (inchars_c > widthlimit_c ? widthlimit_c : inchars_c);
-			int maxindex_b = u8_offset(x->x_buf + inindex_b, maxindex_c);
-		    int eatchar = 1;
-			int foundit_b  = firstone(x->x_buf + inindex_b, '\n', maxindex_b);
-			int foundit_c;
-			//following deals with \v replacement for \n in multiline comments
-			int foundit_bv  = firstone(x->x_buf + inindex_b, '\v', maxindex_b);
-			//fprintf(stderr,"%d %d <%s>\n", foundit_b, foundit_bv, x->x_buf);
-			if ((foundit_bv < foundit_b && foundit_bv != -1) || (foundit_b == -1 && foundit_bv != -1)) foundit_b = foundit_bv;
-			if (foundit_b < 0) //if we did not find an \n
-		    { 
+    //fprintf(stderr,"rtext_senditup <%s>\n", x->x_buf);
+    if (x)
+    {
+        t_float dispx, dispy;
+        char smallbuf[200], *tempbuf;
+        int outchars_b = 0, nlines = 0, ncolumns = 0,
+            pixwide, pixhigh, font, fontwidth, fontheight, findx, findy;
+        int reportedindex = 0;
+        t_canvas *canvas = glist_getcanvas(x->x_glist);
+        int widthspec_c = x->x_text->te_width; // width if any specified
+        // width limit in chars
+        int widthlimit_c = (widthspec_c ? widthspec_c : BOXWIDTH);
+        //fprintf(stderr,"senditup widthlimit_c %d %d\n",
+        //    widthspec_c, widthlimit_c);
+        int inindex_b = 0; // index location in the buffer
+        int inindex_c = 0; // index location in the u8 chars
+        int selstart_b = 0, selend_b = 0; // selection start and end
+        // buffer size in u8 chars
+        int x_bufsize_c = u8_charnum(x->x_buf, x->x_bufsize);
+            /* if we're a GOP (the new, "goprect" style) borrow the font size
+            from the inside to preserve the spacing */
+        if (pd_class(&x->x_text->te_pd) == canvas_class &&
+            ((t_glist *)(x->x_text))->gl_isgraph &&
+            ((t_glist *)(x->x_text))->gl_goprect)
+                font =  glist_getfont((t_glist *)(x->x_text));
+        else font = glist_getfont(x->x_glist);
+        fontwidth = sys_fontwidth(font);
+        fontheight = sys_fontheight(font);
+        // calculating x and y in pixels
+        findx = (*widthp + (fontwidth/2)) / fontwidth;
+        findy = *heightp / fontheight;
+        if (x->x_bufsize >= 100)
+             tempbuf = (char *)t_getbytes(2 * x->x_bufsize + 1);
+        else tempbuf = smallbuf;
+        while (x_bufsize_c - inindex_c > 0)
+        {
+            int inchars_b  = x->x_bufsize - inindex_b;
+            int inchars_c  = x_bufsize_c  - inindex_c;
+            int maxindex_c =
+                (inchars_c > widthlimit_c ? widthlimit_c : inchars_c);
+            int maxindex_b = u8_offset(x->x_buf + inindex_b, maxindex_c);
+            int eatchar = 1;
+            int foundit_b  = firstone(x->x_buf + inindex_b, '\n', maxindex_b);
+            int foundit_c;
+            //following deals with \v replacement for \n in multiline comments
+            int foundit_bv  = firstone(x->x_buf + inindex_b, '\v', maxindex_b);
+            //fprintf(stderr,"%d %d <%s>\n", foundit_b, foundit_bv, x->x_buf);
+            if ((foundit_bv < foundit_b && foundit_bv != -1) ||
+                (foundit_b == -1 && foundit_bv != -1))
+                foundit_b = foundit_bv;
+            if (foundit_b < 0) //if we did not find an \n
+            { 
                 /* too much text to fit in one line? */
-		        if (inchars_c > widthlimit_c)
-		        {
+                if (inchars_c > widthlimit_c)
+                {
                     /* is there a space to break the line at?  OK if it's even
                     one byte past the end since in this context we know there's
                     more text */
-					foundit_b = lastone(x->x_buf + inindex_b, ' ', maxindex_b + 1);
-					if (foundit_b < 0)
-		            {
-						foundit_b = maxindex_b;
-						foundit_c = maxindex_c;
-		                eatchar = 0;
-		            }
-					else
-						foundit_c = u8_charnum(x->x_buf + inindex_b, foundit_b);
-		        }
-		        else
-		        {
-					foundit_b = inchars_b;
-					foundit_c = inchars_c;
-		            eatchar = 0;
-		        }
-		    }
-			else
-				foundit_c = u8_charnum(x->x_buf + inindex_b, foundit_b);
-
-		    if (nlines == findy)
-		    {
-		        int actualx = (findx < 0 ? 0 :
-		            (findx > foundit_c ? foundit_c : findx));
-		        *indexp = inindex_b + u8_offset(x->x_buf + inindex_b, actualx);
-		        reportedindex = 1;
-		    }
-			//fprintf(stderr,"eatchar %d <%s>\n", eatchar, tempbuf);
-		    strncpy(tempbuf+outchars_b, x->x_buf + inindex_b, foundit_b);
-		    if (x->x_selstart >= inindex_b &&
-		        x->x_selstart <= inindex_b + foundit_b + eatchar)
-		            selstart_b = x->x_selstart + outchars_b - inindex_b;
-		    if (x->x_selend >= inindex_b &&
-		        x->x_selend <= inindex_b + foundit_b + eatchar)
-		            selend_b = x->x_selend + outchars_b - inindex_b;
-		    outchars_b += foundit_b;
-		    inindex_b += (foundit_b + eatchar);
-		    inindex_c += (foundit_c + eatchar);
-		    if (inindex_b < x->x_bufsize)
-		        tempbuf[outchars_b++] = '\n';
-		    if (foundit_c > ncolumns) // if we found a row that is longer than previous (total width)
-		        ncolumns = foundit_c;
-			nlines++;
-		}
-		// append new line in case we end our input with an \n
-		if (x->x_buf[x_bufsize_c - 1] == '\n') {
-			nlines++;
-		}
-		if (!reportedindex)
-		    *indexp = outchars_b;
-		dispx = text_xpix(x->x_text, x->x_glist);
-		dispy = text_ypix(x->x_text, x->x_glist);
-		if (nlines < 1) nlines = 1;
-		if (!widthspec_c)
-		{
-		    while (ncolumns < (x->x_text->te_type == T_TEXT ? 1 : 3))
-		    {
-		        tempbuf[outchars_b++] = ' ';
-		        ncolumns++;
-		    }
-		}
-		else ncolumns = widthspec_c;
-		pixwide = ncolumns * fontwidth + (LMARGIN + RMARGIN);
-		pixhigh = nlines * fontheight + (TMARGIN + BMARGIN);
-
-	    if (action && x->x_text->te_width && x->x_text->te_type != T_ATOM)
-	    {
-	            /* if our width is specified but the "natural" width is the
-	            same as the specified width, set specified width to zero
-	            so future text editing will automatically change width.
-	            Except atoms whose content changes at runtime. */
-	        int widthwas = x->x_text->te_width, newwidth = 0, newheight = 0,
-	            newindex = 0;
-	        x->x_text->te_width = 0;
-	        rtext_senditup(x, 0, &newwidth, &newheight, &newindex);
-	        if (newwidth/fontwidth != widthwas)
-	            x->x_text->te_width = widthwas;
-	        else x->x_text->te_width = 0;
-			//fprintf(stderr,"senditup width %d %d %d\n", newwidth/fontwidth, widthwas, x->x_text->te_width);
-	    }
-		if (action == SEND_FIRST) {
-			//fprintf(stderr,"canvas=.x%lx %s\n", (t_int)canvas, tempbuf);
-		    sys_vgui("pdtk_text_new .x%lx.c {%s %s text} %f %f {%.*s} %d %s\n",
-		        canvas, x->x_tag, rtext_gettype(x)->s_name,
-		        dispx + LMARGIN, dispy + TMARGIN,
-		        outchars_b, tempbuf, sys_hostfontsize(font),
-		        (glist_isselected(x->x_glist,
-		            &x->x_glist->gl_gobj)? "$pd_colors(selection)" : "$pd_colors(text)"));
-		}
-		else if (action == SEND_UPDATE)
-		{
-			/*fprintf(stderr, "SEND_UPDATE canvas_class=%d isgraph=%d goprect=%d\n",
-				(pd_class(&x->x_text->te_pd) == canvas_class ? 1 : 0),
-				((t_glist *)(x->x_text))->gl_isgraph,
-				((t_glist *)(x->x_text))->gl_goprect );*/
-		    sys_vgui("pdtk_text_set .x%lx.c %s {%.*s}\n",
-		        canvas, x->x_tag, outchars_b, tempbuf);
-			/*if ( pd_class(&x->x_text->te_pd) == canvas_class &&
-		    	((t_glist *)(x->x_text))->gl_isgraph &&
-		    	(((t_glist *)(x->x_text))->gl_goprect) ) {
-				fprintf(stderr, "do not update outlets\n");
-			}
-			else */
-			if (pixwide != x->x_drawnwidth || pixhigh != x->x_drawnheight) 
-		        text_drawborder(x->x_text, x->x_glist, x->x_tag,
-		            pixwide, pixhigh, 0);
-		    if (x->x_active)
-		    {
-		        if (selend_b > selstart_b)
-		        {
-		            sys_vgui(".x%lx.c select from %s %d\n", canvas, 
-		                x->x_tag, u8_charnum(tempbuf, selstart_b));
-		            sys_vgui(".x%lx.c select to %s %d\n", canvas, 
-		                x->x_tag, u8_charnum(tempbuf, selend_b)
-					  	+ (sys_oldtclversion ? 0 : -1));
-		            sys_vgui(".x%lx.c focus \"\"\n", canvas);        
-		        }
-		        else
-		        {
-		            sys_vgui(".x%lx.c select clear\n", canvas);
-		            sys_vgui(".x%lx.c icursor %s %d\n", canvas, x->x_tag,
-		                u8_charnum(tempbuf, selstart_b));
-		            sys_vgui(".x%lx.c focus %s\n", canvas, x->x_tag);        
-		        }
-		    }
-		}
-		x->x_drawnwidth = pixwide;
-		x->x_drawnheight = pixhigh;
-		
-		*widthp = pixwide;
-		*heightp = pixhigh;
-		if (tempbuf != smallbuf)
-		    t_freebytes(tempbuf, 2 * x->x_bufsize + 1);
-	}
+                    foundit_b =
+                        lastone(x->x_buf + inindex_b, ' ', maxindex_b + 1);
+                    if (foundit_b < 0)
+                    {
+                        foundit_b = maxindex_b;
+                        foundit_c = maxindex_c;
+                        eatchar = 0;
+                    }
+                    else
+                        foundit_c = u8_charnum(x->x_buf + inindex_b, foundit_b);
+                }
+                else
+                {
+                    foundit_b = inchars_b;
+                    foundit_c = inchars_c;
+                    eatchar = 0;
+                }
+            }
+            else
+                foundit_c = u8_charnum(x->x_buf + inindex_b, foundit_b);
+
+            if (nlines == findy)
+            {
+                int actualx = (findx < 0 ? 0 :
+                    (findx > foundit_c ? foundit_c : findx));
+                *indexp = inindex_b + u8_offset(x->x_buf + inindex_b, actualx);
+                reportedindex = 1;
+            }
+            //fprintf(stderr,"eatchar %d <%s>\n", eatchar, tempbuf);
+            strncpy(tempbuf+outchars_b, x->x_buf + inindex_b, foundit_b);
+            if (x->x_selstart >= inindex_b &&
+                x->x_selstart <= inindex_b + foundit_b + eatchar)
+                    selstart_b = x->x_selstart + outchars_b - inindex_b;
+            if (x->x_selend >= inindex_b &&
+                x->x_selend <= inindex_b + foundit_b + eatchar)
+                    selend_b = x->x_selend + outchars_b - inindex_b;
+            outchars_b += foundit_b;
+            inindex_b += (foundit_b + eatchar);
+            inindex_c += (foundit_c + eatchar);
+            if (inindex_b < x->x_bufsize)
+                tempbuf[outchars_b++] = '\n';
+            // if we found a row that is longer than previous (total width)
+            if (foundit_c > ncolumns)
+                ncolumns = foundit_c;
+            nlines++;
+        }
+        // append new line in case we end our input with an \n
+        if (x->x_buf[x_bufsize_c - 1] == '\n')
+        {
+            nlines++;
+        }
+        if (!reportedindex)
+            *indexp = outchars_b;
+        dispx = text_xpix(x->x_text, x->x_glist);
+        dispy = text_ypix(x->x_text, x->x_glist);
+        if (nlines < 1) nlines = 1;
+        if (!widthspec_c)
+        {
+            while (ncolumns < (x->x_text->te_type == T_TEXT ? 1 : 3))
+            {
+                tempbuf[outchars_b++] = ' ';
+                ncolumns++;
+            }
+        }
+        else ncolumns = widthspec_c;
+        pixwide = ncolumns * fontwidth + (LMARGIN + RMARGIN);
+        pixhigh = nlines * fontheight + (TMARGIN + BMARGIN);
+
+        if (action && x->x_text->te_width && x->x_text->te_type != T_ATOM)
+        {
+                /* if our width is specified but the "natural" width is the
+                same as the specified width, set specified width to zero
+                so future text editing will automatically change width.
+                Except atoms whose content changes at runtime. */
+            int widthwas = x->x_text->te_width, newwidth = 0, newheight = 0,
+                newindex = 0;
+            x->x_text->te_width = 0;
+            rtext_senditup(x, 0, &newwidth, &newheight, &newindex);
+            if (newwidth/fontwidth != widthwas)
+                x->x_text->te_width = widthwas;
+            else x->x_text->te_width = 0;
+            //fprintf(stderr,"senditup width %d %d %d\n",
+            //    newwidth/fontwidth, widthwas, x->x_text->te_width);
+        }
+        if (action == SEND_FIRST)
+        {
+            //fprintf(stderr,"canvas=.x%lx %s\n", (t_int)canvas, tempbuf);
+            sys_vgui("pdtk_text_new .x%lx.c {%s %s text} %f %f {%.*s} %d %s\n",
+                canvas, x->x_tag, rtext_gettype(x)->s_name,
+                dispx + LMARGIN, dispy + TMARGIN,
+                outchars_b, tempbuf, sys_hostfontsize(font),
+                (glist_isselected(x->x_glist,
+                    &x->x_glist->gl_gobj)? "$pd_colors(selection)" :
+                        "$pd_colors(text)"));
+        }
+        else if (action == SEND_UPDATE)
+        {
+            /*fprintf(stderr,
+                "SEND_UPDATE canvas_class=%d isgraph=%d goprect=%d\n",
+                (pd_class(&x->x_text->te_pd) == canvas_class ? 1 : 0),
+                ((t_glist *)(x->x_text))->gl_isgraph,
+                ((t_glist *)(x->x_text))->gl_goprect );*/
+
+            sys_vgui("pdtk_text_set .x%lx.c %s {%.*s}\n",
+                canvas, x->x_tag, outchars_b, tempbuf);
+
+            /*if ( pd_class(&x->x_text->te_pd) == canvas_class &&
+                ((t_glist *)(x->x_text))->gl_isgraph &&
+                (((t_glist *)(x->x_text))->gl_goprect) )
+            {
+                fprintf(stderr, "do not update outlets\n");
+            }
+            else */
+
+            if (pixwide != x->x_drawnwidth || pixhigh != x->x_drawnheight) 
+                text_drawborder(x->x_text, x->x_glist, x->x_tag,
+                    pixwide, pixhigh, 0);
+            if (x->x_active)
+            {
+                if (selend_b > selstart_b)
+                {
+                    sys_vgui(".x%lx.c select from %s %d\n", canvas, 
+                        x->x_tag, u8_charnum(tempbuf, selstart_b));
+                    sys_vgui(".x%lx.c select to %s %d\n", canvas, 
+                        x->x_tag, u8_charnum(tempbuf, selend_b)
+                          + (sys_oldtclversion ? 0 : -1));
+                    sys_vgui(".x%lx.c focus \"\"\n", canvas);        
+                }
+                else
+                {
+                    sys_vgui(".x%lx.c select clear\n", canvas);
+                    sys_vgui(".x%lx.c icursor %s %d\n", canvas, x->x_tag,
+                        u8_charnum(tempbuf, selstart_b));
+                    sys_vgui(".x%lx.c focus %s\n", canvas, x->x_tag);        
+                }
+            }
+        }
+        x->x_drawnwidth = pixwide;
+        x->x_drawnheight = pixhigh;
+        
+        *widthp = pixwide;
+        *heightp = pixhigh;
+        if (tempbuf != smallbuf)
+            t_freebytes(tempbuf, 2 * x->x_bufsize + 1);
+    }
 }
 
 void rtext_retext(t_rtext *x)
@@ -443,9 +462,9 @@ t_rtext *glist_findrtext(t_glist *gl, t_text *who)
     t_rtext *x=NULL;
     if (!gl->gl_editor)
         canvas_create_editor(gl);
-	if (gl->gl_editor->e_rtext)
-	    for (x = gl->gl_editor->e_rtext; x && x->x_text != who; x = x->x_next)
-    	    ;
+    if (gl->gl_editor->e_rtext)
+        for (x = gl->gl_editor->e_rtext; x && x->x_text != who; x = x->x_next)
+            ;
     if (!x) bug("glist_findrtext");
     return (x);
 }
@@ -456,9 +475,9 @@ t_rtext *glist_tryfindrtext(t_glist *gl, t_text *who)
     t_rtext *x=NULL;
     if (!gl->gl_editor)
         canvas_create_editor(gl);
-	if (gl->gl_editor->e_rtext)
-	    for (x = gl->gl_editor->e_rtext; x && x->x_text != who; x = x->x_next)
-    	    ;
+    if (gl->gl_editor->e_rtext)
+        for (x = gl->gl_editor->e_rtext; x && x->x_text != who; x = x->x_next)
+            ;
     return (x);
 }
 
@@ -484,8 +503,8 @@ void rtext_draw(t_rtext *x)
 
 void rtext_erase(t_rtext *x)
 {
-	if (x && x->x_glist)
-	    sys_vgui(".x%lx.c delete %s\n", glist_getcanvas(x->x_glist), x->x_tag);
+    if (x && x->x_glist)
+        sys_vgui(".x%lx.c delete %s\n", glist_getcanvas(x->x_glist), x->x_tag);
 }
 
 void rtext_displace(t_rtext *x, int dx, int dy)
@@ -498,17 +517,18 @@ void rtext_select(t_rtext *x, int state)
 {
     t_glist *glist = x->x_glist;
     t_canvas *canvas = glist_getcanvas(glist);
-	if (glist_istoplevel(glist))
-		sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", canvas, 
-		    x->x_tag, (state? "$pd_colors(selection)" : "$pd_colors(text)"));
-	if (x->x_text->te_pd->c_wb && x->x_text->te_pd->c_wb->w_displacefnwtag) {
-		if (state)
-			sys_vgui(".x%lx.c addtag selected withtag %s\n",
-			   	glist_getcanvas(glist), x->x_tag);
-		else
-			sys_vgui(".x%lx.c dtag %s selected\n",
-		   		glist_getcanvas(glist), x->x_tag);
-	}
+    if (glist_istoplevel(glist))
+        sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", canvas, 
+            x->x_tag, (state? "$pd_colors(selection)" : "$pd_colors(text)"));
+    if (x->x_text->te_pd->c_wb && x->x_text->te_pd->c_wb->w_displacefnwtag)
+    {
+        if (state)
+            sys_vgui(".x%lx.c addtag selected withtag %s\n",
+                   glist_getcanvas(glist), x->x_tag);
+        else
+            sys_vgui(".x%lx.c dtag %s selected\n",
+                   glist_getcanvas(glist), x->x_tag);
+    }
     canvas_editing = canvas;
 }
 
@@ -543,16 +563,16 @@ void rtext_activate(t_rtext *x, int state)
 // using ctrl+left/right and similar shortcuts
 static int rtext_compare_special_chars(const char c)
 {
-		if (c != '\n' && c != '\v' && c != ' ')
-			return 0;
-		return 1;
+        if (c != '\n' && c != '\v' && c != ' ')
+            return 0;
+        return 1;
 }
 
 void rtext_key(t_rtext *x, int keynum, t_symbol *keysym)
 {
     int w = 0, h = 0, indx, i, newsize, ndel;
     char *s1, *s2;
-	//fprintf(stderr,"rtext_key keysym=%s\n", keysym->s_name);
+    //fprintf(stderr,"rtext_key keysym=%s\n", keysym->s_name);
     if (keynum)
     {
         int n = keynum;
@@ -565,19 +585,22 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym)
             {
                 ....
             } */
-            if (x->x_selstart && (x->x_selstart == x->x_selend)) {
+            if (x->x_selstart && (x->x_selstart == x->x_selend))
+            {
                 u8_dec(x->x_buf, &x->x_selstart);
-				if (glist_isvisible(glist_getcanvas(x->x_glist)))
-					sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)glist_getcanvas(x->x_glist));
-			}
-			
+                if (glist_isvisible(glist_getcanvas(x->x_glist)))
+                    sys_vgui("pdtk_canvas_getscroll .x%lx.c\n",
+                        (t_int)glist_getcanvas(x->x_glist));
+            }
+            
         }
         else if (n == 127)      /* delete */
         {
             if (x->x_selend < x->x_bufsize && (x->x_selstart == x->x_selend))
                 u8_inc(x->x_buf, &x->x_selend);
-			if (glist_isvisible(glist_getcanvas(x->x_glist)))
-				sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)glist_getcanvas(x->x_glist));
+            if (glist_isvisible(glist_getcanvas(x->x_glist)))
+                sys_vgui("pdtk_canvas_getscroll .x%lx.c\n",
+                    (t_int)glist_getcanvas(x->x_glist));
         }
         
         ndel = x->x_selend - x->x_selstart;
@@ -598,7 +621,7 @@ be printable in whatever 8-bit character set we find ourselves. */
 */
         if (n == '\n' || (n > 31 && n < 127))
         {
-			//fprintf(stderr,"return or 31-127\n");
+            //fprintf(stderr,"return or 31-127\n");
             newsize = x->x_bufsize+1;
             x->x_buf = resizebytes(x->x_buf, x->x_bufsize, newsize);
             for (i = x->x_bufsize; i > x->x_selstart; i--)
@@ -606,13 +629,14 @@ be printable in whatever 8-bit character set we find ourselves. */
             x->x_buf[x->x_selstart] = n;
             x->x_bufsize = newsize;
             x->x_selstart = x->x_selstart + 1;
-			if (glist_isvisible(glist_getcanvas(x->x_glist)))
-				sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)glist_getcanvas(x->x_glist));
+            if (glist_isvisible(glist_getcanvas(x->x_glist)))
+                sys_vgui("pdtk_canvas_getscroll .x%lx.c\n",
+                    (t_int)glist_getcanvas(x->x_glist));
         }
-		/*--moo: check for unicode codepoints beyond 7-bit ASCII --*/
-		else if (n > 127)
-		{
-			//fprintf(stderr,">127\n");
+        /*--moo: check for unicode codepoints beyond 7-bit ASCII --*/
+        else if (n > 127)
+        {
+            //fprintf(stderr,">127\n");
             int ch_nbytes = u8_wc_nbytes(n);
             newsize = x->x_bufsize + ch_nbytes;
             x->x_buf = resizebytes(x->x_buf, x->x_bufsize, newsize);
@@ -635,7 +659,7 @@ be printable in whatever 8-bit character set we find ourselves. */
         }
         else
             x->x_selstart = x->x_selend;
-		last_sel = 0;		
+        last_sel = 0;        
     }
     else if (!strcmp(keysym->s_name, "Left"))
     {
@@ -646,39 +670,47 @@ be printable in whatever 8-bit character set we find ourselves. */
         }
         else
             x->x_selend = x->x_selstart;
-		last_sel = 0;
+        last_sel = 0;
     }
     else if (!strcmp(keysym->s_name, "ShiftRight"))
     {
-		if (!last_sel) last_sel = 2;
-		if (last_sel == 1 && x->x_selstart < x->x_selend) {
-		    if (x->x_selstart < x->x_bufsize)
-		        u8_inc(x->x_buf, &x->x_selstart);		
-		} else {
-			last_sel = 2;
-		    if (x->x_selend < x->x_bufsize)
-		        u8_inc(x->x_buf, &x->x_selend);
-		}
+        if (!last_sel) last_sel = 2;
+        if (last_sel == 1 && x->x_selstart < x->x_selend)
+        {
+            if (x->x_selstart < x->x_bufsize)
+                u8_inc(x->x_buf, &x->x_selstart);        
+        }
+        else
+        {
+            last_sel = 2;
+            if (x->x_selend < x->x_bufsize)
+                u8_inc(x->x_buf, &x->x_selend);
+        }
     }
     else if (!strcmp(keysym->s_name, "ShiftLeft"))
     {
-		if (!last_sel) last_sel = 1;
-        if (last_sel == 2 && x->x_selend > x->x_selstart) {
+        if (!last_sel) last_sel = 1;
+        if (last_sel == 2 && x->x_selend > x->x_selstart)
+        {
             x->x_selend = x->x_selend - 1;
-		} else {
-			last_sel = 1;
-		    if (x->x_selstart > 0)
-		        u8_dec(x->x_buf, &x->x_selstart);
-		}
+        }
+        else
+        {
+            last_sel = 1;
+            if (x->x_selstart > 0)
+                u8_dec(x->x_buf, &x->x_selstart);
+        }
     }
     else if (!strcmp(keysym->s_name, "Up"))
     {
         if (x->x_selstart)
             u8_dec(x->x_buf, &x->x_selstart);
-        while (x->x_selstart > 0 && (x->x_buf[x->x_selstart] != '\n' && x->x_buf[x->x_selstart] != '\v'))
+        while (x->x_selstart > 0 &&
+            (x->x_buf[x->x_selstart] != '\n' &&
+                x->x_buf[x->x_selstart] != '\v'))
             u8_dec(x->x_buf, &x->x_selstart);
         x->x_selend = x->x_selstart;
-		last_sel = 0;
+        last_sel = 0;
     }
     else if (!strcmp(keysym->s_name, "Down"))
     {
@@ -688,7 +720,7 @@ be printable in whatever 8-bit character set we find ourselves. */
         if (x->x_selend < x->x_bufsize)
             u8_inc(x->x_buf, &x->x_selend);
         x->x_selstart = x->x_selend;
-		last_sel = 0;
+        last_sel = 0;
     }
     else if (!strcmp(keysym->s_name, "Home"))
     {
@@ -697,7 +729,7 @@ be printable in whatever 8-bit character set we find ourselves. */
         while (x->x_selstart > 0 && x->x_buf[x->x_selstart] != '\n')
             u8_dec(x->x_buf, &x->x_selstart);
         x->x_selend = x->x_selstart;
-		last_sel = 0;
+        last_sel = 0;
     }
     else if (!strcmp(keysym->s_name, "End"))
     {
@@ -707,128 +739,152 @@ be printable in whatever 8-bit character set we find ourselves. */
         if (x->x_selend < x->x_bufsize)
             u8_inc(x->x_buf, &x->x_selend);
         x->x_selstart = x->x_selend;
-		last_sel = 0;
+        last_sel = 0;
     }
     else if (!strcmp(keysym->s_name, "CtrlLeft"))
     {
-		//fprintf(stderr,"ctrleft\n");
-		/* first find first non-space char going back */
-		while (x->x_selstart > 0 && rtext_compare_special_chars(x->x_buf[x->x_selstart-1])) {
-			//fprintf(stderr,"while 1 <%c>\n", x->x_buf[x->x_selstart-1]);
-			u8_dec(x->x_buf, &x->x_selstart);
-		}
-		/* now go back until you find another space or the beginning of the buffer */
+        //fprintf(stderr,"ctrleft\n");
+        /* first find first non-space char going back */
         while (x->x_selstart > 0 &&
-		  !rtext_compare_special_chars(x->x_buf[x->x_selstart-1])) {
-			//fprintf(stderr,"while 2 <%c>\n", x->x_buf[x->x_selstart-1]);
+            rtext_compare_special_chars(x->x_buf[x->x_selstart-1]))
+        {
+            //fprintf(stderr,"while 1 <%c>\n", x->x_buf[x->x_selstart-1]);
+            u8_dec(x->x_buf, &x->x_selstart);
+        }
+        /* now go back until you find another space or
+           the beginning of the buffer */
+        while (x->x_selstart > 0 &&
+          !rtext_compare_special_chars(x->x_buf[x->x_selstart-1]))
+        {
+            //fprintf(stderr,"while 2 <%c>\n", x->x_buf[x->x_selstart-1]);
             u8_dec(x->x_buf, &x->x_selstart);
-		}
-		if (x->x_buf[x->x_selstart+1] == ' ' &&
-		  x->x_buf[x->x_selstart] == ' ') {
-			//fprintf(stderr,"go forward\n");
-			u8_inc(x->x_buf, &x->x_selstart);
-		}
-		x->x_selend = x->x_selstart;
+        }
+        if (x->x_buf[x->x_selstart+1] == ' ' &&
+            x->x_buf[x->x_selstart] == ' ')
+        {
+            //fprintf(stderr,"go forward\n");
+            u8_inc(x->x_buf, &x->x_selstart);
+        }
+        x->x_selend = x->x_selstart;
     }
     else if (!strcmp(keysym->s_name, "CtrlRight"))
     {
-		/* now go forward until you find another space or the end of the buffer */
-		if (x->x_selend < x->x_bufsize - 1)
-			u8_inc(x->x_buf, &x->x_selend);
+        /* now go forward until you find another space
+           or the end of the buffer */
+        if (x->x_selend < x->x_bufsize - 1)
+            u8_inc(x->x_buf, &x->x_selend);
         while (x->x_selend < x->x_bufsize &&
           !rtext_compare_special_chars(x->x_buf[x->x_selend]))
             u8_inc(x->x_buf, &x->x_selend);
-		/* now skip all the spaces and land before next word */
+        /* now skip all the spaces and land before next word */
         /*while (x->x_selend < x->x_bufsize &&
-		  x->x_buf[x->x_selend] == ' ')
+          x->x_buf[x->x_selend] == ' ')
             u8_inc(x->x_buf, &x->x_selend);
-		if (x->x_selend > 0 && x->x_buf[x->x_selend-1] == ' ')
-			u8_dec(x->x_buf, &x->x_selend);*/
-		x->x_selstart = x->x_selend;
+        if (x->x_selend > 0 && x->x_buf[x->x_selend-1] == ' ')
+            u8_dec(x->x_buf, &x->x_selend);*/
+        x->x_selstart = x->x_selend;
     }
     else if (!strcmp(keysym->s_name, "CtrlShiftLeft"))
-	{
-		//fprintf(stderr,"ctrlshiftleft %d %d %d\n", last_sel, x->x_selstart, x->x_selend);
-		int swap = 0;
-		int *target;
-		if (!last_sel) last_sel = 1;
-		if (last_sel == 2 && x->x_selend > x->x_selstart)
-			target = &x->x_selend;
-		else {
-			last_sel = 1;
-			target = &x->x_selstart;
-		}
-		/* first find first non-space char going back */
-		while (*target > 0 && rtext_compare_special_chars(x->x_buf[*target-1])) {
-			u8_dec(x->x_buf, target);
-			//(*target)--;
-		}
-		//fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
-		/* now go back until you find another space or the beginning of the buffer */
+    {
+        //fprintf(stderr,"ctrlshiftleft %d %d %d\n",
+        //    last_sel, x->x_selstart, x->x_selend);
+        int swap = 0;
+        int *target;
+        if (!last_sel) last_sel = 1;
+        if (last_sel == 2 && x->x_selend > x->x_selstart)
+            target = &x->x_selend;
+        else
+        {
+            last_sel = 1;
+            target = &x->x_selstart;
+        }
+        /* first find first non-space char going back */
         while (*target > 0 &&
-		  !rtext_compare_special_chars(x->x_buf[*target-1])) {
-			u8_dec(x->x_buf, target);
+            rtext_compare_special_chars(x->x_buf[*target-1]))
+        {
+            u8_dec(x->x_buf, target);
+            //(*target)--;
+        }
+        //fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
+        /* now go back until you find another space or
+           the beginning of the buffer */
+        while (*target > 0 &&
+            !rtext_compare_special_chars(x->x_buf[*target-1]))
+        {
+            u8_dec(x->x_buf, target);
             //(*target)--;
-		}
-		//fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
-		if (x->x_buf[*target+1] == ' ' &&
-		  x->x_buf[x->x_selstart] == ' ') {
-			u8_inc(x->x_buf, target);
-			//(*target)++;
-		}
-		//fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
-        if (x->x_selstart > x->x_selend) {
-			swap = x->x_selend;
-			x->x_selend = x->x_selstart;
-			x->x_selstart = swap;
-			last_sel = 1;
-		}
-	}
+        }
+        //fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
+        if (x->x_buf[*target+1] == ' ' &&
+            x->x_buf[x->x_selstart] == ' ')
+        {
+            u8_inc(x->x_buf, target);
+            //(*target)++;
+        }
+        //fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
+        if (x->x_selstart > x->x_selend)
+        {
+            swap = x->x_selend;
+            x->x_selend = x->x_selstart;
+            x->x_selstart = swap;
+            last_sel = 1;
+        }
+    }
     else if (!strcmp(keysym->s_name, "CtrlShiftRight"))
-	{
-		//fprintf(stderr,"ctrlshiftright %d %d %d\n", last_sel, x->x_selstart, x->x_selend);
-		int swap = 0;
-		int *target;
-		if (!last_sel) last_sel = 2;
-		if (last_sel == 1 && x->x_selstart < x->x_selend)
-			target = &x->x_selstart;
-		else {
-			last_sel = 2;
-			target = &x->x_selend;
-		}
-		//fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
-		/* now go forward until you find another space or the end of the buffer */
-		if (*target < x->x_bufsize - 1) {
-			//fprintf(stderr,"while 1 <%c>\n", x->x_buf[*target]);
-			u8_inc(x->x_buf, target);
-			//(*target)++;
-		}
-		//fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
+    {
+        //fprintf(stderr,"ctrlshiftright %d %d %d\n",
+        //    last_sel, x->x_selstart, x->x_selend);
+        int swap = 0;
+        int *target;
+        if (!last_sel) last_sel = 2;
+        if (last_sel == 1 && x->x_selstart < x->x_selend)
+            target = &x->x_selstart;
+        else
+        {
+            last_sel = 2;
+            target = &x->x_selend;
+        }
+        //fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
+        /* now go forward until you find another space or
+           the end of the buffer */
+        if (*target < x->x_bufsize - 1)
+        {
+            //fprintf(stderr,"while 1 <%c>\n", x->x_buf[*target]);
+            u8_inc(x->x_buf, target);
+            //(*target)++;
+        }
+        //fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
         while (*target < x->x_bufsize &&
-          !rtext_compare_special_chars(x->x_buf[*target])) {
-			//fprintf(stderr,"while 2 <%c>\n", x->x_buf[*target]);
-			u8_inc(x->x_buf, target);
+            !rtext_compare_special_chars(x->x_buf[*target]))
+        {
+            //fprintf(stderr,"while 2 <%c>\n", x->x_buf[*target]);
+            u8_inc(x->x_buf, target);
             //(*target)++;
-		}
-		/* now skip all the spaces and land before next word */
+        }
+        /* now skip all the spaces and land before next word */
+
         /*while (*target < x->x_bufsize &&
-		  x->x_buf[*target] == ' ') {
-			u8_inc(x->x_buf, target);
+            x->x_buf[*target] == ' ')
+        {
+            u8_inc(x->x_buf, target);
             //(*target)++;
-		}
-		if (*target > 0 && x->x_buf[*target-1] == ' ') {
-			u8_dec(x->x_buf, target);
-			//(*target)--;
-		}*/
-		//fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
-        if (x->x_selstart > x->x_selend) {
-			swap = x->x_selend;
-			x->x_selend = x->x_selstart;
-			x->x_selstart = swap;
-			last_sel = 2;
-		}
-		//fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
-	}
+        }
+        if (*target > 0 && x->x_buf[*target-1] == ' ')
+        {
+            u8_dec(x->x_buf, target);
+            //(*target)--;
+        }*/
+
+        //fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
+        if (x->x_selstart > x->x_selend)
+        {
+            swap = x->x_selend;
+            x->x_selend = x->x_selstart;
+            x->x_selstart = swap;
+            last_sel = 2;
+        }
+        //fprintf(stderr,"%d %d\n", x->x_selstart, x->x_selend);
+    }
 
     rtext_senditup(x, SEND_UPDATE, &w, &h, &indx);
 }
diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index 6b93e1a556111b6df47d0bd9aa8d11807bb645c1..2565db5cbf45126fc5ac67f94e6d7d63266fe39b 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -37,7 +37,8 @@ t_widgetbehavior text_widgetbehavior;
 static char *invalid_fill = "$::pd_colors(dash_fill)";
 
 extern void canvas_apply_setundo(t_canvas *x, t_gobj *y);
-extern void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf, const char *name);
+extern void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf,
+    const char *name);
 extern void *canvas_undo_set_create(t_canvas *x);
 extern void canvas_undo_create(t_canvas *x, void *z, int action);
 extern int we_are_undoing;
@@ -57,13 +58,14 @@ void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
     t_atom at;
     x->te_width = 0;                            /* don't know it yet. */
     x->te_type = T_TEXT;
-	x->te_iemgui = 0;
+    x->te_iemgui = 0;
     x->te_binbuf = binbuf_new();
     if (argc > 1)
     {
         x->te_xpix = atom_getfloatarg(0, argc, argv);
         x->te_ypix = atom_getfloatarg(1, argc, argv);
-        if (argc > 2) {
+        if (argc > 2)
+        {
             binbuf_restore(x->te_binbuf, argc-2, argv+2);
         }
         else
@@ -76,8 +78,8 @@ void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
     else
     {
         //int xpix, ypix;
-		int connectme, xpix, ypix, indx, nobj;
-		canvas_howputnew(gl, &connectme, &xpix, &ypix, &indx, &nobj);
+        int connectme, xpix, ypix, indx, nobj;
+        canvas_howputnew(gl, &connectme, &xpix, &ypix, &indx, &nobj);
         pd_vmess((t_pd *)glist_getcanvas(gl), gensym("editmode"), "i", 1);
         SETSYMBOL(&at, gensym("comment"));
         glist_noselect(gl);
@@ -94,9 +96,9 @@ void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
             and objects though since there's no text in them at menu
             creation. */
             /* gobj_activate(&x->te_g, gl, 1); */
-		if (!we_are_undoing)
-			canvas_undo_add(glist_getcanvas(gl), 9, "create",
-				(void *)canvas_undo_set_create(glist_getcanvas(gl)));
+        if (!we_are_undoing)
+            canvas_undo_add(glist_getcanvas(gl), 9, "create",
+                (void *)canvas_undo_set_create(glist_getcanvas(gl)));
         if (connectme == 0) canvas_startmotion(glist_getcanvas(gl));
     }
 }
@@ -107,18 +109,19 @@ extern t_pd *newest;
 extern void glist_scalar(t_glist *canvas, t_symbol *s, int argc, t_atom *argv);
 void canvas_getargs(int *argcp, t_atom **argvp);
 
-static void canvas_objtext(t_glist *gl, int xpix, int ypix, int width, int selected,
+static void canvas_objtext(t_glist *gl, int xpix, int ypix,
+    int width, int selected,
     t_binbuf *b)
 {
-	//fprintf(stderr,"canvas_objtext\n");
+    //fprintf(stderr,"canvas_objtext\n");
     t_text *x;
     int argc;
     t_atom *argv;
 
-	// for hiding arguments
-	t_atom *vec;
-	int len, i, hidden;
-	t_binbuf *hide;
+    // for hiding arguments
+    t_atom *vec;
+    int len, i, hidden;
+    t_binbuf *hide;
 
     newest = 0;
     canvas_setcurrent((t_canvas *)gl);
@@ -136,7 +139,8 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int width, int selec
                     canvas_makebindsym(atom_getsymbol(scalar_at));
                 if (template_findbyname(templatesym))
                 {
-                    //post("Hmm, we found a scalar from %s... let's try to instantiate it!", templatesym->s_name);
+                    //post("Hmm, found a scalar from struct %s... ",
+                    //    templatesym->s_name);
                     t_binbuf *scalarbuf = binbuf_new();
                     t_atom coords_at[2];
                     SETFLOAT(coords_at, (t_float)xpix);
@@ -145,7 +149,8 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int width, int selec
                     binbuf_add(scalarbuf, 2, coords_at);
                     binbuf_add(scalarbuf, binbuf_getnatom(b)-1, scalar_at+1);
                     t_atom *scalar_create_at = binbuf_getvec(scalarbuf);
-                    glist_scalar(gl, gensym("scalar_from_canvas_objtext"), binbuf_getnatom(b)+2, scalar_create_at);
+                    glist_scalar(gl, gensym("scalar_from_canvas_objtext"),
+                        binbuf_getnatom(b)+2, scalar_create_at);
                     binbuf_free(scalarbuf);
                     binbuf_free(b);
                     canvas_unsetcurrent((t_canvas *)gl);
@@ -165,29 +170,33 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int width, int selec
     else x = 0;
     if (!x)
     {
-		/* LATER make the color reflect this */
-		//fprintf(stderr,"creating blank object\n");
-		x = (t_text *)pd_new(text_class);
-    }
-	/* special case: an object, like preset_hub, hides its arguments beyond the first n, so
-	   we modify its binbuf here */
-	vec = binbuf_getvec(b);
-	len = binbuf_getnatom(b);
-	hidden = 0;
-	for (i = 0; i < len; i++) {
-		if (!strcmp("%hidden%", atom_getsymbol(&vec[i])->s_name)) {
-			//fprintf(stderr,"found hidden %d %s\n", i, atom_getsymbol(&vec[i])->s_name);
-			hidden = i;
-			break;
-		}
-	}
-	if (hidden) {
-		hide = binbuf_new();
-		binbuf_add(hide, hidden, vec);
-		binbuf_free(b);
-		b = hide;
-	}
-	/* done special case */
+        /* LATER make the color reflect this */
+        //fprintf(stderr,"creating blank object\n");
+        x = (t_text *)pd_new(text_class);
+    }
+    /* special case: an object, like preset_hub, hides its arguments
+       beyond the first n, so we modify its binbuf here */
+    vec = binbuf_getvec(b);
+    len = binbuf_getnatom(b);
+    hidden = 0;
+    for (i = 0; i < len; i++)
+    {
+        if (!strcmp("%hidden%", atom_getsymbol(&vec[i])->s_name))
+        {
+            //fprintf(stderr,"found hidden %d %s\n",
+            //    i, atom_getsymbol(&vec[i])->s_name);
+            hidden = i;
+            break;
+        }
+    }
+    if (hidden)
+    {
+        hide = binbuf_new();
+        binbuf_add(hide, hidden, vec);
+        binbuf_free(b);
+        b = hide;
+    }
+    /* done special case */
 
     x->te_binbuf = b;
 
@@ -195,9 +204,10 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int width, int selec
     x->te_ypix = ypix;
     x->te_width = width;
     x->te_type = T_OBJECT;
-	/* let's see if iemgui objects did not already set the value to 1, otherwise set it explicitly to 0 */
-	if (x->te_iemgui != 1)
-		x->te_iemgui = 0;
+    /* let's see if iemgui objects did not already set the value to 1,
+       otherwise set it explicitly to 0 */
+    if (x->te_iemgui != 1)
+        x->te_iemgui = 0;
     glist_add(gl, &x->te_g);
 
     if (selected)
@@ -211,18 +221,21 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int width, int selec
     if (pd_class(&x->ob_pd) == voutlet_class)
         canvas_resortoutlets(glist_getcanvas(gl));
     canvas_unsetcurrent((t_canvas *)gl);
-	// here we recreate data buffer inside previously created undo snapshot
-	//canvas_undo_create(glist_getcanvas(gl), glist_getcanvas(gl)->u_last->data, UNDO_FREE);
-	//glist_getcanvas(gl)->u_last->data = canvas_undo_set_create(glist_getcanvas(gl));
-	/*if (binbuf_getnatom(x->te_binbuf) && !we_are_undoing) {
-		fprintf(stderr,"canvas_objtext calls create undo\n");
-		//glist_select(gl, &x->te_g);
-		canvas_undo_add(glist_getcanvas(gl), 9, "create",
-			(void *)canvas_undo_set_create(glist_getcanvas(gl)));
-	}*/
-	if ( glist_isvisible( ((t_canvas *)gl) ) ) {
-		sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", glist_getcanvas(gl));
-	}
+    // here we recreate data buffer inside previously created undo snapshot
+    //canvas_undo_create(glist_getcanvas(gl),
+    //    glist_getcanvas(gl)->u_last->data, UNDO_FREE);
+    //glist_getcanvas(gl)->u_last->data =
+    //    canvas_undo_set_create(glist_getcanvas(gl));
+    /*if (binbuf_getnatom(x->te_binbuf) && !we_are_undoing) {
+        fprintf(stderr,"canvas_objtext calls create undo\n");
+        //glist_select(gl, &x->te_g);
+        canvas_undo_add(glist_getcanvas(gl), 9, "create",
+            (void *)canvas_undo_set_create(glist_getcanvas(gl)));
+    }*/
+    if ( glist_isvisible( ((t_canvas *)gl) ) )
+    {
+        sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", glist_getcanvas(gl));
+    }
 }
 
 extern int sys_noautopatch;
@@ -232,17 +245,18 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
     int *indexp, int *totalp)
 {
     int xpix, ypix, indx = 0, nobj = 0, n2, x1, x2, y1, y2;
-	t_gobj *selected;
+    t_gobj *selected;
 
-	/*
-	int connectme = 0;
-	if (x->gl_editor->e_selection &&
+    /*
+    int connectme = 0;
+    if (x->gl_editor->e_selection &&
         !x->gl_editor->e_selection->sel_next &&
-		!sys_noautopatch) {
-			selected = x->gl_editor->e_selection->sel_what;
-			t_object *ob = pd_checkobject(&selected->g_pd);
-    		connectme = (obj_noutlets(ob) ? 1 : 0);
-	}*/
+        !sys_noautopatch)
+    {
+        selected = x->gl_editor->e_selection->sel_what;
+        t_object *ob = pd_checkobject(&selected->g_pd);
+        connectme = (obj_noutlets(ob) ? 1 : 0);
+    }*/
     int connectme = (x->gl_editor->e_selection &&
         !x->gl_editor->e_selection->sel_next);
     if (connectme)
@@ -269,18 +283,19 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
             else if (!g->g_next)
                 indx = nobj-1;
         }
-		x->gl_editor->e_onmotion = MA_NONE;
-		sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
+        x->gl_editor->e_onmotion = MA_NONE;
+        sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
     }
     else
     {
         glist_getnextxy(x, xpixp, ypixp);
         glist_noselect(x);
     }
-	if (sys_noautopatch) {
-		if (connectme == 1) connectme = -1;
-		else connectme = 0;
-	}
+    if (sys_noautopatch)
+    {
+        if (connectme == 1) connectme = -1;
+        else connectme = 0;
+    }
     *connectp = connectme;
     *indexp = indx;
     *totalp = nobj;
@@ -294,7 +309,7 @@ EXTERN int connect_exception;
 
 void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
 {
-	//fprintf(stderr,"canvas_obj\n");
+    //fprintf(stderr,"canvas_obj\n");
     if (canvas_hasarray(gl)) return;
     t_text *x;
     if (argc >= 2)
@@ -315,60 +330,69 @@ void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
         canvas_howputnew(gl, &connectme, &xpix, &ypix, &indx, &nobj);
         pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1);
         canvas_objtext(gl, xpix, ypix, 0, 1, b);
-        if (connectme == 1) {
-			//fprintf(stderr,"canvas_obj calls canvas_connect\n");
-			connect_exception = 1;
+        if (connectme == 1)
+        {
+            //fprintf(stderr,"canvas_obj calls canvas_connect\n");
+            connect_exception = 1;
             canvas_connect(gl, indx, 0, nobj, 0);
-			connect_exception = 0;
-		}
-        else if (connectme == 0) {
-			//fprintf(stderr,"canvas_obj calls canvas_startmotion\n");
-			canvas_startmotion(glist_getcanvas(gl));
-		}
-		//canvas_setundo(glist_getcanvas(gl), canvas_undo_create, canvas_undo_set_create(gl), "create");
-		if (!we_are_undoing)
-			canvas_undo_add(glist_getcanvas(gl), 9, "create",
-				(void *)canvas_undo_set_create(glist_getcanvas(gl)));
+            connect_exception = 0;
+        }
+        else if (connectme == 0)
+        {
+            //fprintf(stderr,"canvas_obj calls canvas_startmotion\n");
+            canvas_startmotion(glist_getcanvas(gl));
+        }
+        //canvas_setundo(glist_getcanvas(gl),
+        //    canvas_undo_create, canvas_undo_set_create(gl), "create");
+        if (!we_are_undoing)
+            canvas_undo_add(glist_getcanvas(gl), 9, "create",
+                (void *)canvas_undo_set_create(glist_getcanvas(gl)));
     }
 }
 
 extern void glist_setlastxy(t_glist *gl, int xval, int yval);
 
 /* invoked from tcl/tk: abstraction_name x_offset y_offset */
-void canvas_obj_abstraction_from_menu(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
+void canvas_obj_abstraction_from_menu(t_glist *gl, t_symbol *s,
+    int argc, t_atom *argv)
 {
     if (canvas_hasarray(gl)) return;
-	//fprintf(stderr,"canvas_abstraction_from_menu\n");
+    //fprintf(stderr,"canvas_abstraction_from_menu\n");
     //t_text *x;
-	t_gobj *y;
+    t_gobj *y;
 
     t_binbuf *b = binbuf_new();
-	binbuf_restore(b, 2, argv);
+    binbuf_restore(b, 2, argv);
     int connectme, xpix, ypix, indx, nobj;
     canvas_howputnew(gl, &connectme, &xpix, &ypix, &indx, &nobj);
     pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1);
 #ifdef PDL2ORK
-	if (sys_k12_mode)
-		pd_vmess (&gl->gl_pd, gensym("tooltips"), "i", 1);
+    if (sys_k12_mode)
+        pd_vmess (&gl->gl_pd, gensym("tooltips"), "i", 1);
 #endif
-    canvas_objtext(gl, xpix+atom_getintarg(1, argc, argv), ypix+atom_getintarg(2, argc, argv), 0, 1, b);
-
-	// the object is now the last on the glist so we locate it and send it loadbang
-	// we know we have at least one object since we just created one so we don't check for y being valid
-	y = gl->gl_list;
-	while (y->g_next)
-		y = y->g_next;
-	canvas_loadbang((t_canvas *)y);
+    canvas_objtext(gl, xpix+atom_getintarg(1, argc, argv),
+        ypix+atom_getintarg(2, argc, argv), 0, 1, b);
+
+    // the object is now the last on the glist so we locate it
+    // and send it loadbang
+    // we know we have at least one object since we just created one
+    // so we don't check for y being valid
+    y = gl->gl_list;
+    while (y->g_next)
+        y = y->g_next;
+    canvas_loadbang((t_canvas *)y);
 
-    if (connectme == 1) {
+    if (connectme == 1)
+    {
         canvas_connect(gl, indx, 0, nobj, 0);
-	}
-    else if (connectme == 0) {
-		canvas_startmotion(glist_getcanvas(gl));
-	}
-	canvas_undo_add(glist_getcanvas(gl), 9, "create",
-		(void *)canvas_undo_set_create(glist_getcanvas(gl)));
-	glist_setlastxy(glist_getcanvas(gl), xpix, ypix);
+    }
+    else if (connectme == 0)
+    {
+        canvas_startmotion(glist_getcanvas(gl));
+    }
+    canvas_undo_add(glist_getcanvas(gl), 9, "create",
+        (void *)canvas_undo_set_create(glist_getcanvas(gl)));
+    glist_setlastxy(glist_getcanvas(gl), xpix, ypix);
 }
 
 /* make an object box for an object that's already there. */
@@ -377,42 +401,46 @@ void canvas_obj_abstraction_from_menu(t_glist *gl, t_symbol *s, int argc, t_atom
 void canvas_iemguis(t_glist *gl, t_symbol *guiobjname)
 {
     if (canvas_hasarray(gl)) return;
-	//fprintf(stderr,"canvas_iemguis\n");
+    //fprintf(stderr,"canvas_iemguis\n");
     t_atom at;
     t_binbuf *b = binbuf_new();
     //int xpix, ypix;
 
-	if(!strcmp(guiobjname->s_name, "cnv"))
-		glist_noselect(gl);
+    if(!strcmp(guiobjname->s_name, "cnv"))
+        glist_noselect(gl);
 
-	int connectme, xpix, ypix, indx, nobj;
+    int connectme, xpix, ypix, indx, nobj;
     canvas_howputnew(gl, &connectme, &xpix, &ypix, &indx, &nobj);
 
-	/*NOT NECESSARY ANY MORE: compensate for the iemgui sliders' xyoffset in case of autopatch
-	if(connectme) {
-		if(!strcmp(guiobjname->s_name, "hsl"))
-			xpix = xpix + 3;
-		else if(!strcmp(guiobjname->s_name, "vsl"))
-			ypix = ypix + 2;
-		else if(!strcmp(guiobjname->s_name, "vu")) {
-			xpix = xpix + 1;
-			ypix = ypix + 2;
-		}
-	}*/
-	
+    /* NOT NECESSARY ANY MORE: compensate for the iemgui sliders' xyoffset
+       in case of autopatch
+    if (connectme)
+    {
+        if(!strcmp(guiobjname->s_name, "hsl"))
+            xpix = xpix + 3;
+        else if(!strcmp(guiobjname->s_name, "vsl"))
+            ypix = ypix + 2;
+        else if(!strcmp(guiobjname->s_name, "vu"))
+        {
+            xpix = xpix + 1;
+            ypix = ypix + 2;
+        }
+    }*/
+    
     pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1);
     glist_noselect(gl);
     SETSYMBOL(&at, guiobjname);
     binbuf_restore(b, 1, &at);
-	canvas_objtext(gl, xpix, ypix, 0, 1, b);
+    canvas_objtext(gl, xpix, ypix, 0, 1, b);
     if (connectme == 1)
         canvas_connect(gl, indx, 0, nobj, 0);
     //glist_getnextxy(gl, &xpix, &ypix);
     //canvas_objtext(gl, xpix, ypix, 1, b);
     else if (connectme == 0 ) canvas_startmotion(glist_getcanvas(gl));
-	//canvas_setundo(glist_getcanvas(gl), canvas_undo_create, canvas_undo_set_create(gl), "create");
-	canvas_undo_add(glist_getcanvas(gl), 9, "create",
-		(void *)canvas_undo_set_create(glist_getcanvas(gl)));
+    //canvas_setundo(glist_getcanvas(gl),
+    //    canvas_undo_create, canvas_undo_set_create(gl), "create");
+    canvas_undo_add(glist_getcanvas(gl), 9, "create",
+        (void *)canvas_undo_set_create(glist_getcanvas(gl)));
 }
 
 void canvas_bng(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
@@ -569,14 +597,14 @@ static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
     binbuf_clear(x->m_text.te_binbuf);
     binbuf_add(x->m_text.te_binbuf, argc, argv);
     glist_retext(x->m_glist, &x->m_text);
-	sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
+    sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
 }
 
 static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
 {
     binbuf_add(x->m_text.te_binbuf, argc, argv);
     glist_retext(x->m_glist, &x->m_text);
-	sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
+    sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
 }
 
 static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
@@ -584,7 +612,7 @@ static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
     binbuf_add(x->m_text.te_binbuf, argc, argv);
     binbuf_addsemi(x->m_text.te_binbuf);
     glist_retext(x->m_glist, &x->m_text);
-	sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
+    sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
 }
 
 static void message_addcomma(t_message *x)
@@ -593,13 +621,13 @@ static void message_addcomma(t_message *x)
     SETCOMMA(&a);
     binbuf_add(x->m_text.te_binbuf, 1, &a);
     glist_retext(x->m_glist, &x->m_text);
-	sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
+    sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
 }
 
 static void message_addsemi(t_message *x)
 {
     message_add(x, 0, 0, 0);
-	sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
+    sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
 }
 
 static void message_adddollar(t_message *x, t_floatarg f)
@@ -611,7 +639,7 @@ static void message_adddollar(t_message *x, t_floatarg f)
     SETDOLLAR(&a, n);
     binbuf_add(x->m_text.te_binbuf, 1, &a);
     glist_retext(x->m_glist, &x->m_text);
-	sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
+    sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
 }
 
 static void message_adddollsym(t_message *x, t_symbol *s)
@@ -624,7 +652,7 @@ static void message_adddollsym(t_message *x, t_symbol *s)
     SETDOLLSYM(&a, gensym(buf));
     binbuf_add(x->m_text.te_binbuf, 1, &a);
     glist_retext(x->m_glist, &x->m_text);
-	sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
+    sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
 }
 
 static void message_click(t_message *x,
@@ -659,22 +687,23 @@ static void message_free(t_message *x)
 void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
 {
     if (canvas_hasarray(gl)) return;
-	/*fprintf(stderr,"canvas_msg\n");
-	int i = 0;
-	while(i < argc) {
-		if (argv[i].a_type == A_FLOAT)
-			fprintf(stderr," %f", atom_getfloatarg(i, argc, argv));
-		else
-			fprintf(stderr," %s", atom_getsymbolarg(i, argc, argv)->s_name);
-		i++;
-	}
-	fprintf(stderr,"\n");*/
+    /*fprintf(stderr,"canvas_msg\n");
+    int i = 0;
+    while(i < argc)
+    {
+        if (argv[i].a_type == A_FLOAT)
+            fprintf(stderr," %f", atom_getfloatarg(i, argc, argv));
+        else
+            fprintf(stderr," %s", atom_getsymbolarg(i, argc, argv)->s_name);
+        i++;
+    }
+    fprintf(stderr,"\n");*/
     t_message *x = (t_message *)pd_new(message_class);
     x->m_messresponder.mr_pd = messresponder_class;
     x->m_messresponder.mr_outlet = outlet_new(&x->m_text, &s_float);
     x->m_text.te_width = 0;                             /* don't know it yet. */
     x->m_text.te_type = T_MESSAGE;
-	x->m_text.te_iemgui = 0;
+    x->m_text.te_iemgui = 0;
     x->m_text.te_binbuf = binbuf_new();
     x->m_glist = gl;
     x->m_clock = clock_new(x, (t_method)message_tick);
@@ -702,9 +731,10 @@ void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
         if (connectme == 1)
             canvas_connect(gl, indx, 0, nobj, 0);
         else if (connectme == 0) canvas_startmotion(glist_getcanvas(gl));
-		//canvas_setundo(glist_getcanvas(gl), canvas_undo_create, canvas_undo_set_create(gl), "create");
-		canvas_undo_add(glist_getcanvas(gl), 9, "create",
-			(void *)canvas_undo_set_create(glist_getcanvas(gl)));
+        //canvas_setundo(glist_getcanvas(gl),
+        //    canvas_undo_create, canvas_undo_set_create(gl), "create");
+        canvas_undo_add(glist_getcanvas(gl), 9, "create",
+            (void *)canvas_undo_set_create(glist_getcanvas(gl)));
     }
 }
 
@@ -766,15 +796,15 @@ static void gatom_redraw(t_gobj *client, t_glist *glist)
     glist_retext(x->a_glist, &x->a_text);
 }
 
-	/* recolor option offers 	0 ignore recolor
-								1 recolor */
+    /* recolor option offers     0 ignore recolor
+                                1 recolor */
 static void gatom_retext(t_gatom *x, int senditup, int recolor)
 {
-	t_canvas *canvas = glist_getcanvas(x->a_glist);
-	t_rtext *y = glist_findrtext(x->a_glist, &x->a_text);
-	if (recolor)
-		sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", canvas, 
-	    	rtext_gettag(y), "$pd_colors(text)");
+    t_canvas *canvas = glist_getcanvas(x->a_glist);
+    t_rtext *y = glist_findrtext(x->a_glist, &x->a_text);
+    if (recolor)
+        sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", canvas, 
+            rtext_gettag(y), "$pd_colors(text)");
     binbuf_clear(x->a_text.te_binbuf);
     binbuf_add(x->a_text.te_binbuf, 1, &x->a_atom);
     if (senditup && glist_isvisible(x->a_glist))
@@ -895,7 +925,7 @@ static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy)
 
 static void gatom_key(void *z, t_floatarg f)
 {
-	//fprintf(stderr,"gatom_key %f\n", f);
+    //fprintf(stderr,"gatom_key %f\n", f);
     t_gatom *x = (t_gatom *)z;
     int c = f;
     int len = strlen(x->a_buf);
@@ -906,8 +936,8 @@ static void gatom_key(void *z, t_floatarg f)
         /* we're being notified that no more keys will come for this grab */
         if (x->a_buf[0])
             gatom_retext(x, 1, 1);
-		else
-			gatom_retext(x, 0, 1);
+        else
+            gatom_retext(x, 0, 1);
         return;
     }
     else if (c == '\b')
@@ -998,7 +1028,7 @@ EXTERN int canvas_apply_restore_original_position(t_canvas *x, int pos);
     /* message back from dialog window */
 static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv)
 {
-	canvas_apply_setundo(x->a_glist, (t_gobj *)x);
+    canvas_apply_setundo(x->a_glist, (t_gobj *)x);
 
     t_float width = atom_getfloatarg(0, argc, argv);
     t_float draglo = atom_getfloatarg(1, argc, argv);
@@ -1046,9 +1076,9 @@ static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv)
     x->a_symto = symto;
     x->a_expanded_to = canvas_realizedollar(x->a_glist, x->a_symto);
     gobj_vis(&x->a_text.te_g, x->a_glist, 1);
-	gobj_select(&x->a_text.te_g, x->a_glist, 1);
+    gobj_select(&x->a_text.te_g, x->a_glist, 1);
     canvas_dirty(x->a_glist, 1);
-	sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->a_glist);
+    sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->a_glist);
 
     /* glist_retext(x->a_glist, &x->a_text); */
 }
@@ -1087,18 +1117,19 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp)
 static void gatom_displace(t_gobj *z, t_glist *glist,
     int dx, int dy)
 {
-	//fprintf(stderr,"gatom_displace\n");
-	t_gatom *x = (t_gatom*)z;
-	text_displace(z, glist, dx, dy);
-	if (glist_isvisible(glist)) {
-		sys_vgui(".x%lx.c move %lx.l %d %d\n", glist_getcanvas(glist), 
-		    x, dx, dy);
-	}
+    //fprintf(stderr,"gatom_displace\n");
+    t_gatom *x = (t_gatom*)z;
+    text_displace(z, glist, dx, dy);
+    if (glist_isvisible(glist))
+    {
+        sys_vgui(".x%lx.c move %lx.l %d %d\n", glist_getcanvas(glist), 
+            x, dx, dy);
+    }
 }
 
 static void gatom_vis(t_gobj *z, t_glist *glist, int vis)
 {
-	//fprintf(stderr,"gatom_vis\n");
+    //fprintf(stderr,"gatom_vis\n");
     t_gatom *x = (t_gatom*)z;
     text_vis(z, glist, vis);
     if (*x->a_label->s_name)
@@ -1124,12 +1155,12 @@ void canvas_atom(t_glist *gl, t_atomtype type,
     t_symbol *s, int argc, t_atom *argv)
 {
     if (canvas_hasarray(gl)) return;
-	//fprintf(stderr,"canvas_atom\n");
+    //fprintf(stderr,"canvas_atom\n");
     t_gatom *x = (t_gatom *)pd_new(gatom_class);
     t_atom at;
     x->a_text.te_width = 0;                        /* don't know it yet. */
     x->a_text.te_type = T_ATOM;
-	x->a_text.te_iemgui = 0;
+    x->a_text.te_iemgui = 0;
     x->a_text.te_binbuf = binbuf_new();
     x->a_glist = gl;
     x->a_atom.a_type = type;
@@ -1198,9 +1229,10 @@ void canvas_atom(t_glist *gl, t_atomtype type,
         if (connectme == 1)
             canvas_connect(gl, indx, 0, nobj, 0);
         else if (connectme == 0) canvas_startmotion(glist_getcanvas(gl));
-		//canvas_setundo(glist_getcanvas(gl), canvas_undo_create, canvas_undo_set_create(gl), "create");
-		canvas_undo_add(glist_getcanvas(gl), 9, "create",
-			(void *)canvas_undo_set_create(glist_getcanvas(gl)));
+        //canvas_setundo(glist_getcanvas(gl),
+        //    canvas_undo_create, canvas_undo_set_create(gl), "create");
+        canvas_undo_add(glist_getcanvas(gl), 9, "create",
+            (void *)canvas_undo_set_create(glist_getcanvas(gl)));
     }
 }
 
@@ -1240,7 +1272,7 @@ static void gatom_properties(t_gobj *z, t_glist *owner)
 static void text_getrect(t_gobj *z, t_glist *glist,
     int *xp1, int *yp1, int *xp2, int *yp2)
 {
-	//fprintf(stderr,"text_getrect\n");
+    //fprintf(stderr,"text_getrect\n");
     t_text *x = (t_text *)z;
     int width, height, iscomment = (x->te_type == T_TEXT);
     t_float x1, y1, x2, y2;
@@ -1250,7 +1282,7 @@ static void text_getrect(t_gobj *z, t_glist *glist,
     
     if (x->te_type == T_ATOM && x->te_width > 0)
     {
-		//fprintf(stderr,"	T_ATOM\n");
+        //fprintf(stderr,"    T_ATOM\n");
         int font = glist_getfont(glist);
         int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font);
         width = (x->te_width > 0 ? x->te_width : 6) * fontwidth + 2;
@@ -1265,15 +1297,18 @@ static void text_getrect(t_gobj *z, t_glist *glist,
     // end jsarlo
     else if (x->te_type == T_TEXT)
     {
-		//fprintf(stderr,"	T_TEXT\n");
+        //fprintf(stderr,"    T_TEXT\n");
         t_rtext *y = glist_findrtext(glist, x);
-		if (y) {
-		    width = rtext_width(y);
-			height = rtext_height(y);
-		} else {
-			width = height = 10;
-		}
-		//fprintf(stderr,"T_TEXT width=%d height=%d\n", width, height);
+        if (y)
+        {
+            width = rtext_width(y);
+            height = rtext_height(y);
+        }
+        else
+        {
+            width = height = 10;
+        }
+        //fprintf(stderr,"T_TEXT width=%d height=%d\n", width, height);
     }
         /* if we're invisible we don't know our size so we just lie about
         it.  This is called on invisible boxes to establish order of inlets
@@ -1286,44 +1321,49 @@ static void text_getrect(t_gobj *z, t_glist *glist,
     {
         t_rtext *y = glist_findrtext(glist, x);
         width = rtext_width(y);
-		height = rtext_height(y) - (iscomment << 1);
-
-		//fprintf(stderr,"rtext_width=%d\n", width);
-
-		/*  now find if we have more inlets or outlets than
-			what can comfortably fit and adjust accordingly
-			NB: textless GOPs are unaffected and are treated
-			as GUI objects
-		*/
-
-		//fprintf(stderr,"isgraph %d\n", ((t_glist *)z)->gl_isgraph);
-		//if (!((t_glist *)z)->gl_isgraph) {
-
-		t_object *ob = pd_checkobject(&x->te_pd);
-		int no = obj_noutlets(ob);
-		int ni = obj_ninlets(ob);
-
-		int m = ( ni > no ? ni : no);
-		//let's see if the object has more nlets than its text width and resize them accordingly
-		//UNLESS we are gop in which case it is user's choice how big/small they want the object
-		if (pd_class(&z->g_pd) != canvas_class || 
-				pd_class(&z->g_pd) == canvas_class && !((t_glist *)z)->gl_isgraph) {
-			if (width < (IOWIDTH * m) * 2 - IOWIDTH) {
-				//we have to resize the object
-				width = (IOWIDTH * m) * 2 - IOWIDTH;
-			}
-		}
+        height = rtext_height(y) - (iscomment << 1);
+
+        //fprintf(stderr,"rtext_width=%d\n", width);
+
+        /*  now find if we have more inlets or outlets than
+            what can comfortably fit and adjust accordingly
+            NB: textless GOPs are unaffected and are treated
+            as GUI objects
+        */
+
+        //fprintf(stderr,"isgraph %d\n", ((t_glist *)z)->gl_isgraph);
+        //if (!((t_glist *)z)->gl_isgraph) {
+
+        t_object *ob = pd_checkobject(&x->te_pd);
+        int no = obj_noutlets(ob);
+        int ni = obj_ninlets(ob);
+
+        int m = ( ni > no ? ni : no);
+        //let's see if the object has more nlets than
+        //its text width and resize them accordingly
+        //UNLESS we are gop in which case it is user's choice
+        //how big/small they want the object
+        if (pd_class(&z->g_pd) != canvas_class || 
+                pd_class(&z->g_pd) == canvas_class &&
+                    !((t_glist *)z)->gl_isgraph)
+        {
+            if (width < (IOWIDTH * m) * 2 - IOWIDTH)
+            {
+                //we have to resize the object
+                width = (IOWIDTH * m) * 2 - IOWIDTH;
+            }
+        }
         height = rtext_height(y) - (iscomment << 1);
     }
     else {
-		width = height = 10;
-		//fprintf(stderr,"	default\n");
-	}
+        width = height = 10;
+        //fprintf(stderr,"    default\n");
+    }
     x1 = text_xpix(x, glist);
     y1 = text_ypix(x, glist);
     x2 = x1 + width;
     y2 = y1 + height;
-	//x1 += iscomment*2;
+    //x1 += iscomment*2;
     //y1 += iscomment*6;
     *xp1 = x1;
     *yp1 = y1;
@@ -1334,7 +1374,7 @@ static void text_getrect(t_gobj *z, t_glist *glist,
 static void text_displace(t_gobj *z, t_glist *glist,
     int dx, int dy)
 {
-	//fprintf(stderr,"text_displace\n");
+    //fprintf(stderr,"text_displace\n");
     t_text *x = (t_text *)z;
     x->te_xpix += dx;
     x->te_ypix += dy;
@@ -1351,7 +1391,7 @@ static void text_displace(t_gobj *z, t_glist *glist,
 static void text_displace_withtag(t_gobj *z, t_glist *glist,
     int dx, int dy)
 {
-	//fprintf(stderr,"text_displace_withtag\n");
+    //fprintf(stderr,"text_displace_withtag\n");
     t_text *x = (t_text *)z;
     x->te_xpix += dx;
     x->te_ypix += dy;
@@ -1361,34 +1401,40 @@ static void text_displace_withtag(t_gobj *z, t_glist *glist,
         //text_drawborder_withtag(x, glist, rtext_gettag(y),
         //    rtext_width(y), rtext_height(y), 0);
         canvas_fixlinesfor(glist_getcanvas(glist), x);
-		/*if this is a subpatcher in which case we may be possibly moving nlets around
-		  which in turn requires that we redraw parent's nlets */
-/*		if (glist->gl_owner && glist_isvisible(glist->gl_owner)) {
-		    int resortin = 0, resortout = 0;
-		    t_class *cl = pd_class(&z->g_pd);
-		    if (cl == vinlet_class) resortin = 1;
-		    else if (cl == voutlet_class) resortout = 1;
-			fprintf(stderr,"vinlet=%d voutlet=%d\n", resortin, resortout);
-			if (resortin) canvas_resortinlets(glist->gl_owner);
-			if (resortout) canvas_resortoutlets(glist->gl_owner);
-
-			char *buf;
-			char name[6];
-			int bufsize, i;
-			rtext_gettext(y, &buf, &bufsize);
-			for (i = 0; i < 5; i++) {
-				name[i] = buf[i];
-			}
-			name[5] = '\0';
-			//fprintf(stderr,"yes, this is a subpatch with visible parent %s\n", name);
-			if (!strcmp(name, "inlet") ||
-				!strcmp(name, "outle")) {
-				
-				//fprintf(stderr,"yes, we're moving nlets around\n");	
-				glist_redraw(glist->gl_owner);
-			}
-		}*/
-    }	
+        /* if this is a subpatcher in which case we may be
+           possibly moving nlets around
+           which in turn requires that we redraw parent's nlets */
+
+/*        if (glist->gl_owner && glist_isvisible(glist->gl_owner))
+          {
+            int resortin = 0, resortout = 0;
+            t_class *cl = pd_class(&z->g_pd);
+            if (cl == vinlet_class) resortin = 1;
+            else if (cl == voutlet_class) resortout = 1;
+            fprintf(stderr,"vinlet=%d voutlet=%d\n", resortin, resortout);
+            if (resortin) canvas_resortinlets(glist->gl_owner);
+            if (resortout) canvas_resortoutlets(glist->gl_owner);
+
+            char *buf;
+            char name[6];
+            int bufsize, i;
+            rtext_gettext(y, &buf, &bufsize);
+            for (i = 0; i < 5; i++)
+            {
+                name[i] = buf[i];
+            }
+            name[5] = '\0';
+            //fprintf(stderr,"yes, this is a subpatch with visible parent %s\n",
+            //    name);
+            if (!strcmp(name, "inlet") ||
+                !strcmp(name, "outle"))
+            {
+                
+                //fprintf(stderr,"yes, we're moving nlets around\n");    
+                glist_redraw(glist->gl_owner);
+            }
+        }*/
+    }    
 }
 
 static void gatom_displace_withtag(t_gobj *z, t_glist *glist,
@@ -1406,7 +1452,7 @@ static void text_select(t_gobj *z, t_glist *glist, int state)
     t_rtext *y = glist_findrtext(glist, x);
     char *outline;
     rtext_select(y, state);
-	//fprintf(stderr,"text_select %s %d\n", rtext_gettag(y), state);
+    //fprintf(stderr,"text_select %s %d\n", rtext_gettag(y), state);
 
     // text_class is either a comment or an object that failed to creates
     // so we distinguish between it and comment using T_TEXT type check
@@ -1416,70 +1462,89 @@ static void text_select(t_gobj *z, t_glist *glist, int state)
         outline = "$pd_colors(atom_box_border)";
     else
         outline = "$pd_colors(box_border)";
-	//fprintf(stderr,"text_select isvisible=%d shouldvis=%d istoplevel=%d\n", glist_isvisible(glist), gobj_shouldvis(&x->te_g, glist), glist_istoplevel(glist));
-    if (gobj_shouldvis(&x->te_g, glist)) {
-		if (glist_istoplevel(glist)) {
-		    sys_vgui(".x%lx.c itemconfigure %sR -stroke %s\n", glist_getcanvas(glist), 
-		             rtext_gettag(y), (state? "$pd_colors(selection)" : outline));
-			if (z->g_pd == gatom_class) {
-				sys_vgui(".x%lx.c itemconfigure %lx.l -fill %s\n", glist_getcanvas(glist), 
-					x, (state? "$pd_colors(selection)" : "$pd_colors(text)"));
-			}
-		}
-		if (z->g_pd->c_wb && z->g_pd->c_wb->w_displacefnwtag) {
-			int i, ni, no;
-			if (state) {
-				if (z->g_pd == gatom_class) {
-					sys_vgui(".x%lx.c addtag selected withtag %lx.l\n",
-						glist_getcanvas(glist), x);					
-				}
-		    	sys_vgui(".x%lx.c addtag selected withtag %sR \n",
-		    	    glist_getcanvas(glist), rtext_gettag(y));
-
-				if (pd_class(&x->te_pd) == text_class && glist_istoplevel(glist))
-	        		sys_vgui(".x%lx.c itemconfigure %sR -strokewidth 1 -fill $pd_colors(box)\n",
-						glist_getcanvas(glist), rtext_gettag(y));
-
-				t_object *ob = pd_checkobject(&x->te_pd);
-				int no = obj_noutlets(ob);
-				int ni = obj_ninlets(ob);
-
-				for (i = 0; i < no; i++) {
-					sys_vgui(".x%lx.c addtag selected withtag %so%d \n",
-									glist_getcanvas(glist), rtext_gettag(y), i);
-				}
-				for (i = 0; i < ni; i++) {
-					sys_vgui(".x%lx.c addtag selected withtag %si%d \n",
-        	    		glist_getcanvas(glist), rtext_gettag(y), i);
-				}
-			} else {
-				if (z->g_pd == gatom_class) {
-					sys_vgui(".x%lx.c dtag %lx.l selected\n",
-						glist_getcanvas(glist), x);					
-				}
-		    	sys_vgui(".x%lx.c dtag %sR selected\n",
-		        	glist_getcanvas(glist), rtext_gettag(y));
-
-				if (pd_class(&x->te_pd) == text_class)
-			   		sys_vgui(".x%lx.c itemconfigure %sR -strokewidth 2 -fill %s\n",
-						glist_getcanvas(glist), 
-		            	rtext_gettag(y), invalid_fill);
-
-				t_object *ob = pd_checkobject(&x->te_pd);
-				int no = obj_noutlets(ob);
-				int ni = obj_ninlets(ob);
-
-				for (i = 0; i < no; i++) {
-					sys_vgui(".x%lx.c dtag %so%d selected\n",
-		    	    	glist_getcanvas(glist), rtext_gettag(y), i);
-				}
-				for (i = 0; i < ni; i++) {
-					sys_vgui(".x%lx.c dtag %si%d selected\n",
-		    	    	glist_getcanvas(glist), rtext_gettag(y), i);
-				}
-			}
-		}
-	}
+    //fprintf(stderr,"text_select isvisible=%d shouldvis=%d istoplevel=%d\n",
+    //    glist_isvisible(glist), gobj_shouldvis(&x->te_g, glist),
+    //    glist_istoplevel(glist));
+    if (gobj_shouldvis(&x->te_g, glist))
+    {
+        if (glist_istoplevel(glist))
+        {
+            sys_vgui(".x%lx.c itemconfigure %sR -stroke %s\n",
+                glist_getcanvas(glist), rtext_gettag(y),
+                (state? "$pd_colors(selection)" : outline));
+            if (z->g_pd == gatom_class)
+            {
+                sys_vgui(".x%lx.c itemconfigure %lx.l -fill %s\n",
+                    glist_getcanvas(glist), x,
+                    (state? "$pd_colors(selection)" : "$pd_colors(text)"));
+            }
+        }
+        if (z->g_pd->c_wb && z->g_pd->c_wb->w_displacefnwtag)
+        {
+            int i, ni, no;
+            if (state)
+            {
+                if (z->g_pd == gatom_class)
+                {
+                    sys_vgui(".x%lx.c addtag selected withtag %lx.l\n",
+                        glist_getcanvas(glist), x);                    
+                }
+                sys_vgui(".x%lx.c addtag selected withtag %sR \n",
+                    glist_getcanvas(glist), rtext_gettag(y));
+
+                if (pd_class(&x->te_pd) == text_class && glist_istoplevel(glist))
+                    sys_vgui(".x%lx.c itemconfigure %sR -strokewidth 1 "
+                             "-fill $pd_colors(box)\n",
+                        glist_getcanvas(glist), rtext_gettag(y));
+
+                t_object *ob = pd_checkobject(&x->te_pd);
+                int no = obj_noutlets(ob);
+                int ni = obj_ninlets(ob);
+
+                for (i = 0; i < no; i++)
+                {
+                    sys_vgui(".x%lx.c addtag selected withtag %so%d \n",
+                                    glist_getcanvas(glist), rtext_gettag(y), i);
+                }
+                for (i = 0; i < ni; i++)
+                {
+                    sys_vgui(".x%lx.c addtag selected withtag %si%d \n",
+                        glist_getcanvas(glist), rtext_gettag(y), i);
+                }
+            }
+            else
+            {
+                if (z->g_pd == gatom_class)
+                {
+                    sys_vgui(".x%lx.c dtag %lx.l selected\n",
+                        glist_getcanvas(glist), x);                    
+                }
+                sys_vgui(".x%lx.c dtag %sR selected\n",
+                    glist_getcanvas(glist), rtext_gettag(y));
+
+                if (pd_class(&x->te_pd) == text_class)
+                       sys_vgui(".x%lx.c itemconfigure %sR -strokewidth 2 "
+                                "-fill %s\n",
+                        glist_getcanvas(glist), 
+                        rtext_gettag(y), invalid_fill);
+
+                t_object *ob = pd_checkobject(&x->te_pd);
+                int no = obj_noutlets(ob);
+                int ni = obj_ninlets(ob);
+
+                for (i = 0; i < no; i++)
+                {
+                    sys_vgui(".x%lx.c dtag %so%d selected\n",
+                        glist_getcanvas(glist), rtext_gettag(y), i);
+                }
+                for (i = 0; i < ni; i++)
+                {
+                    sys_vgui(".x%lx.c dtag %si%d selected\n",
+                        glist_getcanvas(glist), rtext_gettag(y), i);
+                }
+            }
+        }
+    }
 }
 
 static void text_activate(t_gobj *z, t_glist *glist, int state)
@@ -1497,47 +1562,51 @@ static void text_delete(t_gobj *z, t_glist *glist)
 
 static void text_vis(t_gobj *z, t_glist *glist, int vis)
 {
-	//fprintf(stderr,"text_vis %d\n", vis);
+    //fprintf(stderr,"text_vis %d\n", vis);
     t_text *x = (t_text *)z;
 
 #ifdef PDL2ORK
-	//if we are in k12 mode and this is hub with level 1 (global) don't draw it and make its width/height 0
-	int exception = 0;
-	if (pd_class(&x->te_pd) == preset_hub_class && sys_k12_mode) {
-		//fprintf(stderr,"text_vis reports preset_hub_class detected\n");
-		t_preset_hub *h = (t_preset_hub *)z;
-		if (h->ph_invis) {
-			exception = 1;
-			x->te_width = 0;
-		}
-	}
-	if (!exception) {
+    //if we are in k12 mode and this is hub with level 1 (global)
+    //don't draw it and make its width/height 0
+    int exception = 0;
+    if (pd_class(&x->te_pd) == preset_hub_class && sys_k12_mode)
+    {
+        //fprintf(stderr,"text_vis reports preset_hub_class detected\n");
+        t_preset_hub *h = (t_preset_hub *)z;
+        if (h->ph_invis)
+        {
+            exception = 1;
+            x->te_width = 0;
+        }
+    }
+    if (!exception)
+    {
 #endif
-		if (vis)
-		{
-		    if (gobj_shouldvis(&x->te_g, glist))
-		    {
-				//fprintf(stderr,"	draw it\n");
-		        t_rtext *y = glist_findrtext(glist, x);
-		        if (x->te_type == T_ATOM)
-		            glist_retext(glist, x);
-		        text_drawborder(x, glist, rtext_gettag(y),
-		            rtext_width(y), rtext_height(y), 1);
-		        rtext_draw(y);
-		    }
-		}
-		else
-		{
-		    t_rtext *y = glist_findrtext(glist, x);
-		    if (gobj_shouldvis(&x->te_g, glist))
-		    {
-				//fprintf(stderr,"	erase it\n");
-		        text_eraseborder(x, glist, rtext_gettag(y));
-		        rtext_erase(y);
-		    }
-		}
+        if (vis)
+        {
+            if (gobj_shouldvis(&x->te_g, glist))
+            {
+                //fprintf(stderr,"    draw it\n");
+                t_rtext *y = glist_findrtext(glist, x);
+                if (x->te_type == T_ATOM)
+                    glist_retext(glist, x);
+                text_drawborder(x, glist, rtext_gettag(y),
+                    rtext_width(y), rtext_height(y), 1);
+                rtext_draw(y);
+            }
+        }
+        else
+        {
+            t_rtext *y = glist_findrtext(glist, x);
+            if (gobj_shouldvis(&x->te_g, glist))
+            {
+                //fprintf(stderr,"    erase it\n");
+                text_eraseborder(x, glist, rtext_gettag(y));
+                rtext_erase(y);
+            }
+        }
 #ifdef PDL2ORK
-	}
+    }
 #endif
 }
 
@@ -1560,15 +1629,16 @@ static int text_click(t_gobj *z, struct _glist *glist,
     }
     else if (x->te_type == T_ATOM)
     {
-		t_canvas *canvas = glist_getcanvas(glist);
-		t_rtext *y = glist_findrtext(glist, x);
-        if (doit) {
+        t_canvas *canvas = glist_getcanvas(glist);
+        t_rtext *y = glist_findrtext(glist, x);
+        if (doit)
+        {
             gatom_click((t_gatom *)x, (t_floatarg)xpix, (t_floatarg)ypix,
                 (t_floatarg)shift, (t_floatarg)0, (t_floatarg)alt);
-			//fprintf(stderr,"atom click\n");
-			sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", canvas, 
-		    	rtext_gettag(y), "$pd_colors(selection)");
-		}
+            //fprintf(stderr,"atom click\n");
+            sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", canvas, 
+                rtext_gettag(y), "$pd_colors(selection)");
+        }
         return (1);
     }
     else if (x->te_type == T_MESSAGE)
@@ -1583,7 +1653,7 @@ static int text_click(t_gobj *z, struct _glist *glist,
 
 void text_save(t_gobj *z, t_binbuf *b)
 {
-	//fprintf(stderr, "text_save\n");
+    //fprintf(stderr, "text_save\n");
     t_text *x = (t_text *)z;
     if (x->te_type == T_OBJECT)
     {
@@ -1594,31 +1664,31 @@ void text_save(t_gobj *z, t_binbuf *b)
                 (canvas_isabstraction((t_canvas *)x)
                     || canvas_istable((t_canvas *)x))))
         {  
-			//fprintf(stderr, "saveto\n");
+            //fprintf(stderr, "saveto\n");
             mess1(&x->te_pd, gensym("saveto"), b);
             binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"),
                 (int)x->te_xpix, (int)x->te_ypix);
         }
         else    /* otherwise just save the text */
         {
-			//fprintf(stderr, "is this gop?\n");
+            //fprintf(stderr, "is this gop?\n");
             binbuf_addv(b, "ssii", gensym("#X"), gensym("obj"),
                 (int)x->te_xpix, (int)x->te_ypix);
         }
-		//fprintf(stderr, "this must be it\n");
+        //fprintf(stderr, "this must be it\n");
         binbuf_addbinbuf(b, x->te_binbuf);
-		//fprintf(stderr, "DONE this must be it\n");
+        //fprintf(stderr, "DONE this must be it\n");
     }
     else if (x->te_type == T_MESSAGE)
     {
-		//fprintf(stderr, "message\n");
+        //fprintf(stderr, "message\n");
         binbuf_addv(b, "ssii", gensym("#X"), gensym("msg"),
             (int)x->te_xpix, (int)x->te_ypix);
         binbuf_addbinbuf(b, x->te_binbuf);
     }
     else if (x->te_type == T_ATOM)
     {
-		//fprintf(stderr, "atom\n");
+        //fprintf(stderr, "atom\n");
         t_atomtype t = ((t_gatom *)x)->a_atom.a_type;
         t_symbol *sel = (t == A_SYMBOL ? gensym("symbolatom") :
             (t == A_FLOAT ? gensym("floatatom") : gensym("intatom")));
@@ -1638,16 +1708,21 @@ void text_save(t_gobj *z, t_binbuf *b)
         int natom = binbuf_getnatom(x->te_binbuf);
         t_atom *a = binbuf_getvec(x->te_binbuf);
         int i;
-        for (i = 0; i < natom; i++) {
+        for (i = 0; i < natom; i++)
+        {
             t_symbol *s;
-            if(a[i].a_type == A_SYMBOL) {
+            if(a[i].a_type == A_SYMBOL)
+            {
                 //fprintf(stderr,"%d is a symbol\n", i);
                 s = a[i].a_w.w_symbol;
-                if (s != NULL && s->s_name != NULL) {
+                if (s != NULL && s->s_name != NULL)
+                {
                     //fprintf(stderr,"s != NULL\n");
                     char *c;
-                    for(c = s->s_name; c != NULL && *c != '\0'; c++) {
-                        if(*c == '\n') {
+                    for(c = s->s_name; c != NULL && *c != '\0'; c++)
+                    {
+                        if(*c == '\n')
+                        {
                             *c = '\v';
                             //fprintf(stderr,"n->v\n");
                         }
@@ -1698,10 +1773,11 @@ static t_widgetbehavior gatom_widgetbehavior =
 void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
     char *tag, int x1, int y1, int x2, int y2)
 {
-	//if this is a comment or we are drawing inside gop on one of our parents return
-	if (pd_class(&ob->te_pd) == text_class || glist_getcanvas(glist) != glist)
-		return;
-	//fprintf(stderr,"glist_drawiofor\n");
+    //if this is a comment or we are drawing inside gop on one of
+    //our parents return
+    if (pd_class(&ob->te_pd) == text_class || glist_getcanvas(glist) != glist)
+        return;
+    //fprintf(stderr,"glist_drawiofor\n");
     int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i;
     int width = x2 - x1;
     int issignal;
@@ -1710,29 +1786,31 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
         int onset = x1 + (width - IOWIDTH) * i / nplus;
         if (firsttime)
         {
-			//fprintf(stderr,"glist_drawiofor o firsttime\n");
+            //fprintf(stderr,"glist_drawiofor o firsttime\n");
             issignal = obj_issignaloutlet(ob,i);
             sys_vgui(".x%lx.c create prect %d %d %d %d \
                       -fill %s -stroke %s -tags {%so%d %lx outlet %s}\n",
                 glist_getcanvas(glist), onset, y2 - 2, onset + IOWIDTH, y2,
-                (issignal ? "$pd_colors(signal_nlet)" : "$pd_colors(control_nlet)"),
-                (issignal ? "$pd_colors(signal_cord)" : "$pd_colors(control_cord)"),
+                (issignal ? "$pd_colors(signal_nlet)" :
+                   "$pd_colors(control_nlet)"),
+                (issignal ? "$pd_colors(signal_cord)" :
+                    "$pd_colors(control_cord)"),
                 tag, i, tag,
                 (issignal ? "signal" : "control"));
         }
         else {
-			//fprintf(stderr,"glist_drawiofor o redraw\n");
+            //fprintf(stderr,"glist_drawiofor o redraw\n");
             sys_vgui(".x%lx.c coords %so%d %d %d %d %d\n",
                 glist_getcanvas(glist), tag, i,
                 onset, y2 - 2,
                 onset + IOWIDTH, y2);
-				// jsarlo
-				/*sys_vgui(".x%x.c raise %so%d\n",
-				         glist_getcanvas(glist),
-				         tag,
-				         i);*/
-				// end jsarlo
-		}
+                // jsarlo
+                /*sys_vgui(".x%x.c raise %so%d\n",
+                         glist_getcanvas(glist),
+                         tag,
+                         i);*/
+                // end jsarlo
+        }
     }
     n = obj_ninlets(ob);
     nplus = (n == 1 ? 1 : n-1);
@@ -1741,29 +1819,32 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
         int onset = x1 + (width - IOWIDTH) * i / nplus;
         if (firsttime)
         {
-			//fprintf(stderr,"glist_drawiofor i firsttime\n");
+            //fprintf(stderr,"glist_drawiofor i firsttime\n");
             issignal = obj_issignalinlet(ob,i);
             sys_vgui(".x%lx.c create prect %d %d %d %d \
                       -fill %s -stroke %s -tags {%si%d %lx inlet %s}\n",
-                glist_getcanvas(glist), onset, y1, onset + IOWIDTH, y1 + EXTRAPIX,
-                (issignal ? "$pd_colors(signal_nlet)" : "$pd_colors(control_nlet)"),
-                (issignal ? "$pd_colors(signal_cord)" : "$pd_colors(control_cord)"),
+                glist_getcanvas(glist), onset, y1,
+                onset + IOWIDTH, y1 + EXTRAPIX,
+                (issignal ? "$pd_colors(signal_nlet)" :
+                    "$pd_colors(control_nlet)"),
+                (issignal ? "$pd_colors(signal_cord)" :
+                    "$pd_colors(control_cord)"),
                 tag, i, tag,
                 (issignal ? "signal" : "control"));
         }
         else {
-			//fprintf(stderr,"glist_drawiofor i firsttime\n");
+            //fprintf(stderr,"glist_drawiofor i firsttime\n");
             sys_vgui(".x%lx.c coords %si%d %d %d %d %d\n",
                 glist_getcanvas(glist), tag, i,
                 onset, y1,
                 onset + IOWIDTH, y1 + EXTRAPIX);
-				// jsarlo   
-				/*sys_vgui(".x%x.c raise %si%d\n",
-				         glist_getcanvas(glist),
-				         tag,
-				         i);*/
-				// end jsarlo
-		}
+                // jsarlo   
+                /*sys_vgui(".x%x.c raise %si%d\n",
+                         glist_getcanvas(glist),
+                         tag,
+                         i);*/
+                // end jsarlo
+        }
     }
 }
 
@@ -1771,9 +1852,9 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
 void glist_drawiofor_withtag(t_glist *glist, t_object *ob, int firsttime,
     char *tag, int x1, int y1, int x2, int y2)
 {
-	if (pd_class(&ob->te_pd) == text_class)
-		return;
-	//fprintf(stderr,"drawiofor_withtag\n");
+    if (pd_class(&ob->te_pd) == text_class)
+        return;
+    //fprintf(stderr,"drawiofor_withtag\n");
     int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i;
     int width = x2 - x1;
     int issignal;
@@ -1782,52 +1863,59 @@ void glist_drawiofor_withtag(t_glist *glist, t_object *ob, int firsttime,
         int onset = x1 + (width - IOWIDTH) * i / nplus;
         if (firsttime)
         {
-			//fprintf(stderr,"drawiofor_withtag o firsttime\n");
+            //fprintf(stderr,"drawiofor_withtag o firsttime\n");
             issignal = obj_issignaloutlet(ob,i);
             sys_vgui(".x%lx.c create prect %d %d %d %d \
                       -fill %s -stroke %s -tags {%so%d %lx outlet}\n",
                 glist_getcanvas(glist), onset, y2 - 2, onset + IOWIDTH, y2,
-                (issignal ? "$pd_colors(signal_nlet)" : "$pd_colors(control_nlet)"),
-                (issignal ? "$pd_colors(signal_cord)" : "$pd_colors(control_cord)"),
+                (issignal ? "$pd_colors(signal_nlet)" :
+                    "$pd_colors(control_nlet)"),
+                (issignal ? "$pd_colors(signal_cord)" :
+                    "$pd_colors(control_cord)"),
                 tag, i, tag);
         }
 /*
-		else
-		{
-			sys_vgui(".x%lx.c addtag selected withtag %so%d \n",
-        	    glist_getcanvas(glist), tag, i);
-		}
+        else
+        {
+            sys_vgui(".x%lx.c addtag selected withtag %so%d \n",
+                glist_getcanvas(glist), tag, i);
+        }
 */
     }
     n = obj_ninlets(ob);
-	//fprintf(stderr,"drawiofor_withtag n=%d\n", n);
+    //fprintf(stderr,"drawiofor_withtag n=%d\n", n);
     nplus = (n == 1 ? 1 : n-1);
     for (i = 0; i < n; i++)
     {
         int onset = x1 + (width - IOWIDTH) * i / nplus;
         if (firsttime)
         {
-			//fprintf(stderr,"drawiofor_withtag i firsttime\n");
+            //fprintf(stderr,"drawiofor_withtag i firsttime\n");
             issignal = obj_issignalinlet(ob,i);
             sys_vgui(".x%lx.c create prect %d %d %d %d \
                       -fill %s -stroke %s -tags {%si%d %lx inlet}\n",
-                glist_getcanvas(glist), onset, y1, onset + IOWIDTH, y1 + EXTRAPIX,
-                (issignal ? "$pd_colors(signal_nlet)" : "$pd_colors(control_nlet)"),
-                (issignal ? "$pd_colors(signal_cord)" : "$pd_colors(control_cord)"),
+                glist_getcanvas(glist), onset, y1,
+                onset + IOWIDTH, y1 + EXTRAPIX,
+                (issignal ? "$pd_colors(signal_nlet)" :
+                    "$pd_colors(control_nlet)"),
+                (issignal ? "$pd_colors(signal_cord)" :
+                    "$pd_colors(control_cord)"),
                 tag, i, tag);
         }
-/*		else
-		{
-			//sys_vgui(".x%lx.c addtag selected withtag %si%d \n",
-        	//    glist_getcanvas(glist), tag, i);
-			fprintf(stderr,"drawiofor_withtag i redraw\n");
+/*        else
+        {
+            //sys_vgui(".x%lx.c addtag selected withtag %si%d \n",
+            //    glist_getcanvas(glist), tag, i);
+            fprintf(stderr,"drawiofor_withtag i redraw\n");
             issignal = obj_issignalinlet(ob,i);
             sys_vgui(".x%lx.c itemconfigure %si%d \
                       -fill %s -outline %s\n",
                 glist_getcanvas(glist), tag, i,
-                (issignal ? "$pd_colors(signal_nlet)" : "$pd_colors(control_nlet)"),
-                (issignal ? "$pd_colors(signal_cord)" : "$pd_colors(control_cord)"));
-		}
+                (issignal ? "$pd_colors(signal_nlet)" :
+                    "$pd_colors(control_nlet)"),
+                (issignal ? "$pd_colors(signal_cord)" :
+                    "$pd_colors(control_cord)"));
+        }
 */
     }
 }
@@ -1839,23 +1927,25 @@ void text_drawborder(t_text *x, t_glist *glist,
     t_object *ob;
     int x1, y1, x2, y2, width, height, msg_draw_const, atom_draw_const;
 
-	/* if this is gop patcher, the getrect should be equal to gop-ed window
-	   rather than just the size of text */
-	if (pd_class(&x->te_pd) == canvas_class &&
+    /* if this is gop patcher, the getrect should be equal to gop-ed window
+       rather than just the size of text */
+    if (pd_class(&x->te_pd) == canvas_class &&
         ((t_glist *)x)->gl_isgraph &&
         ((t_glist *)x)->gl_goprect &&
-		!(((t_glist *)x)->gl_havewindow) ) {
-
-		int gop_width = ((t_glist *)x)->gl_pixwidth;
-		int gop_height = ((t_glist *)x)->gl_pixheight;
-		text_getrect(&x->te_g, glist, &x1, &y1, &x2, &y2);
-		/*fprintf(stderr,"text = %d %d %d %d     gop = %d %d\n",
-			x1, y1, x2, y2, gop_width, gop_height); */
-		if (gop_width > (x2-x1)) x2 = x1 + gop_width;
-		if (gop_height > (y2-y1)) y2 = y1 + gop_height;
-	} else {
-    	text_getrect(&x->te_g, glist, &x1, &y1, &x2, &y2);
-	}
+        !(((t_glist *)x)->gl_havewindow) )
+    {
+        int gop_width = ((t_glist *)x)->gl_pixwidth;
+        int gop_height = ((t_glist *)x)->gl_pixheight;
+        text_getrect(&x->te_g, glist, &x1, &y1, &x2, &y2);
+        /*fprintf(stderr,"text = %d %d %d %d     gop = %d %d\n",
+            x1, y1, x2, y2, gop_width, gop_height); */
+        if (gop_width > (x2-x1)) x2 = x1 + gop_width;
+        if (gop_height > (y2-y1)) y2 = y1 + gop_height;
+    }
+    else
+    {
+        text_getrect(&x->te_g, glist, &x1, &y1, &x2, &y2);
+    }
 
     width = x2 - x1;
     height = y2 - y1;
@@ -1875,21 +1965,22 @@ void text_drawborder(t_text *x, t_glist *glist,
         {
             pattern = "\"\"";
             outline = "$pd_colors(box_border)";
-	    fill = "$pd_colors(box)";
+        fill = "$pd_colors(box)";
             box_tag = "box";
         }
         if (firsttime)
-		{
+        {
             sys_vgui(".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d \
                       -stroke %s -fill %s -tags {%sR %lx text %s}\n", 
                 glist_getcanvas(glist),
                      x1, y1,  x2, y1,  x2, y2,  x1, y2,  x1, y1,  
                      outline, fill, tag, tag, box_tag);
-				//-dash %s -> pattern disabled for tkpath
+                //-dash %s -> pattern disabled for tkpath
         }
         else
         {
-			//fprintf(stderr, "redrawing rectangle? .x%lx.c %sR\n", (t_int)glist_getcanvas(glist), tag);
+            //fprintf(stderr, "redrawing rectangle? .x%lx.c %sR\n",
+            //    (t_int)glist_getcanvas(glist), tag);
             sys_vgui(".x%lx.c coords %sR %d %d %d %d %d %d %d %d %d %d\n",
                 glist_getcanvas(glist), tag,
                     x1, y1,  x2, y1,  x2, y2,  x1, y2,  x1, y1);
@@ -1901,15 +1992,17 @@ void text_drawborder(t_text *x, t_glist *glist,
     else if (x->te_type == T_MESSAGE)
     {
         if (firsttime)
-            sys_vgui(".x%lx.c create ppolygon\
- %d %d %d %d %d %d %d %d %d %d %d %d %d %d -stroke $pd_colors(msg_border) -fill $pd_colors(msg) -tags {%sR %lx text msg box}\n",
+            sys_vgui(".x%lx.c create ppolygon "
+                     "%d %d %d %d %d %d %d %d %d %d %d %d %d %d "
+                     "-stroke $pd_colors(msg_border) -fill $pd_colors(msg) "
+                     "-tags {%sR %lx text msg box}\n",
                 glist_getcanvas(glist),
                 x1, y1,  x2+4, y1,  x2, y1+4,  x2, y2-4,  x2+4, y2,
                 x1, y2,  x1, y1,
                     tag, tag);
         else
-            sys_vgui(".x%lx.c coords %sR\
- %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
+            sys_vgui(".x%lx.c coords %sR "
+                     "%d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
                 glist_getcanvas(glist), tag,
                 x1, y1,  x2+4, y1,  x2, y1+4,  x2, y2-4,  x2+4, y2,
                 x1, y2,  x1, y1);
@@ -1917,14 +2010,17 @@ void text_drawborder(t_text *x, t_glist *glist,
     else if (x->te_type == T_ATOM)
     {
         if (firsttime)
-            sys_vgui(".x%lx.c create ppolygon\
- %d %d %d %d %d %d %d %d %d %d %d %d -stroke $pd_colors(atom_box_border) -fill $pd_colors(atom_box) -tags {%sR %lx text atom box}\n",
+            sys_vgui(".x%lx.c create ppolygon "
+                     "%d %d %d %d %d %d %d %d %d %d %d %d "
+                     "-stroke $pd_colors(atom_box_border) "
+                     "-fill $pd_colors(atom_box) "
+                     "-tags {%sR %lx text atom box}\n",
                 glist_getcanvas(glist),
                 x1, y1,  x2-4, y1,  x2, y1+4,  x2, y2,  x1, y2,  x1, y1,
                     tag, tag);
         else
-            sys_vgui(".x%lx.c coords %sR\
- %d %d %d %d %d %d %d %d %d %d %d %d\n",
+            sys_vgui(".x%lx.c coords %sR "
+                     "%d %d %d %d %d %d %d %d %d %d %d %d\n",
                 glist_getcanvas(glist), tag,
                 x1, y1,  x2-4, y1,  x2, y1+4,  x2, y2,  x1, y2,  x1, y1);
     }
@@ -1933,26 +2029,33 @@ void text_drawborder(t_text *x, t_glist *glist,
         locked we erase them all via the annoying "commentbar" tag. */
     else if (x->te_type == T_TEXT && glist->gl_edit)
     {
-        if (firsttime) {
+        if (firsttime)
+        {
             sys_vgui(".x%lx.c create pline\
  %d %d %d %d -tags [list %sR commentbar] -stroke $box_outline\n",
                 glist_getcanvas(glist),
                 x2, y1,  x2, y2, tag);
-        } else {
+        }
+        else
+        {
             sys_vgui(".x%lx.c coords %sR %d %d %d %d\n",
                 glist_getcanvas(glist), tag, x2, y1,  x2, y2);
         }
     }
 
-	/* draw inlets/outlets */    
-    if (ob = pd_checkobject(&x->te_pd)) {
+    /* draw inlets/outlets */    
+    if (ob = pd_checkobject(&x->te_pd))
+    {
         glist_drawiofor(glist, ob, firsttime, tag, x1, y1, x2, y2);
-	}
-    if (firsttime && glist==glist_getcanvas(glist)) /* raise cords over everything else */
+    }
+    /* raise cords over everything else */
+    if (firsttime && glist==glist_getcanvas(glist))
         sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
 
-	//ico@bukvic.net 100518 update scrollbars when GOP potentially exceeds window size
-	//sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (long unsigned int)glist_getcanvas(glist));
+    //ico@bukvic.net 100518 update scrollbars when GOP
+    //potentially exceeds window size
+    //sys_vgui("pdtk_canvas_getscroll .x%lx.c\n",
+    //    (long unsigned int)glist_getcanvas(glist));
 }
 
 void text_drawborder_withtag(t_text *x, t_glist *glist,
@@ -1970,22 +2073,22 @@ void text_drawborder_withtag(t_text *x, t_glist *glist,
         {
             pattern = "-";
             outline = "$pd_colors(dash_outline) -strokewidth 2";
-			fill = invalid_fill;
+            fill = invalid_fill;
         }
         else
         {
             pattern = "\"\"";
             outline = "$pd_colors(box_border)";
-			fill = "$pd_colors(box)";
+            fill = "$pd_colors(box)";
         }
         if (firsttime)
-		{
-            sys_vgui(".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d \
-                      -stroke %s -fill %s -tags {%sR %lx text}\n", 
+        {
+            sys_vgui(".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d"
+                     "-stroke %s -fill %s -tags {%sR %lx text}\n", 
                 glist_getcanvas(glist),
                      x1, y1,  x2, y1,  x2, y2,  x1, y2,  x1, y1,  
                      outline, fill, tag, tag);
-				//-dash %s -> pattern disabled for tkpath
+                //-dash %s -> pattern disabled for tkpath
         }
     }
     else if (x->te_type == T_MESSAGE)
@@ -1993,9 +2096,10 @@ void text_drawborder_withtag(t_text *x, t_glist *glist,
         msg_draw_const = ((y2-y1)/4);
         if (msg_draw_const > 10) msg_draw_const = 10; /* looks bad if too big */
         if (firsttime)
-            sys_vgui(".x%lx.c create ppolygon \
-                     %d %d %d %d %d %d %d %d %d %d %d %d %d %d \
-                     -stroke $pd_colors(msg_border) -fill $pd_colors(msg) -tags {%sR %lx text msg box}\n",
+            sys_vgui(".x%lx.c create ppolygon "
+                     "%d %d %d %d %d %d %d %d %d %d %d %d %d %d "
+                     "-stroke $pd_colors(msg_border) -fill $pd_colors(msg) "
+                     "-tags {%sR %lx text msg box}\n",
                 glist_getcanvas(glist),
                      x1, y1,  x2+msg_draw_const, y1,  x2, y1+msg_draw_const,  
                      x2, y2-msg_draw_const,  x2+msg_draw_const, y2,  
@@ -2006,8 +2110,11 @@ void text_drawborder_withtag(t_text *x, t_glist *glist,
     {
         atom_draw_const = ((y2-y1)/3);
         if (firsttime)
-            sys_vgui(".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d %d %d \
-                     -stroke $pd_colors(atom_box_border) -fill $pd_colors(atom_box) -tags {%sR %lx text atom box}\n",
+            sys_vgui(".x%lx.c create ppolygon "
+                     "%d %d %d %d %d %d %d %d %d %d %d %d "
+                     "-stroke $pd_colors(atom_box_border) "
+                     "-fill $pd_colors(atom_box) "
+                     "-tags {%sR %lx text atom box}\n",
                 glist_getcanvas(glist),
                      x1, y1,  x2-atom_draw_const, y1,  x2, y1+atom_draw_const,  
                      x2, y2,  x1, y2,  x1, y1, 
@@ -2018,32 +2125,39 @@ void text_drawborder_withtag(t_text *x, t_glist *glist,
         locked we erase them all via the annoying "commentbar" tag. */
     else if (x->te_type == T_TEXT && glist->gl_edit)
     {
-        if (firsttime) {
-            sys_vgui(".x%lx.c create pline\
- %d %d %d %d -tags [list %sR commentbar] -stroke $box_outline\n",
+        if (firsttime)
+        {
+            sys_vgui(".x%lx.c create pline %d %d %d %d "
+                     "-tags [list %sR commentbar] -stroke $box_outline\n",
                 glist_getcanvas(glist),
                 x2, y1,  x2, y2, tag);
-        } else {
+        }
+        else
+        {
             sys_vgui(".x%lx.c coords %sR %d %d %d %d\n",
                 glist_getcanvas(glist), tag, x2, y1,  x2, y2);
         }
     }
         /* draw inlets/outlets */
     
-    if (ob = pd_checkobject(&x->te_pd)) {
+    if (ob = pd_checkobject(&x->te_pd))
+    {
         glist_drawiofor_withtag(glist, ob, firsttime, tag, x1, y1, x2, y2);
-	}
-    if (firsttime && glist==glist_getcanvas(glist)) /* raise cords over everything else */
+    }
+    /* raise cords over everything else */
+    if (firsttime && glist==glist_getcanvas(glist))
         sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
 
-	//ico@bukvic.net 100518 update scrollbars when GOP potentially exceeds window size
-	//sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (long unsigned int)glist_getcanvas(glist));
+    //ico@bukvic.net 100518 update scrollbars when GOP
+    //potentially exceeds window size
+    //sys_vgui("pdtk_canvas_getscroll .x%lx.c\n",
+    //    (long unsigned int)glist_getcanvas(glist));
 }
 
 
 void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag)
 {
-	//fprintf(stderr,"glist_eraseiofor\n");
+    //fprintf(stderr,"glist_eraseiofor\n");
     int i, n;
     n = obj_noutlets(ob);
     for (i = 0; i < n; i++)
@@ -2067,10 +2181,10 @@ void text_eraseborder(t_text *x, t_glist *glist, char *tag)
 
 void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos)
 {
-	char *c1, *c2;
-	int i1, i2;
+    char *c1, *c2;
+    int i1, i2;
 
-	//fprintf(stderr,"text_setto %d\n", x->te_type);
+    //fprintf(stderr,"text_setto %d\n", x->te_type);
 
     if (x->te_type == T_OBJECT)
     {
@@ -2082,55 +2196,70 @@ void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos)
         vec1 = binbuf_getvec(x->te_binbuf);
         natom2 = binbuf_getnatom(b);
         vec2 = binbuf_getvec(b);
-            /* special case: if pd subpatch is valid and its args change, and its new name is valid, just pass the message on. */
-        if (x->te_pd == canvas_class && (natom1 >= 1 && natom2 >= 1 && vec1[0].a_type == A_SYMBOL
+        /* special case: if pd subpatch is valid and its args change,
+           and its new name is valid, just pass the message on. */
+        if (x->te_pd == canvas_class &&
+            (natom1 >= 1 && natom2 >= 1 && vec1[0].a_type == A_SYMBOL
             && !strcmp(vec1[0].a_w.w_symbol->s_name, "pd") &&
              vec2[0].a_type == A_SYMBOL
-            && !strcmp(vec2[0].a_w.w_symbol->s_name, "pd") && vec2[1].a_type == A_SYMBOL))
+            && !strcmp(vec2[0].a_w.w_symbol->s_name, "pd") &&
+            vec2[1].a_type == A_SYMBOL))
         {
-			//fprintf(stderr,"setto canvas\n");
-			//first check if the contents have changed to see if there is any point of recreating the object
-			binbuf_gettext(x->te_binbuf, &c1, &i1);
-			binbuf_gettext(b, &c2, &i2);
-			if (strcmp(c1, c2)) {
-				//fprintf(stderr,"string differs\n");
-				canvas_undo_add(glist_getcanvas(glist), 10, "recreate",
-					(void *)canvas_undo_set_recreate(glist_getcanvas(glist), &x->te_g, pos));
-		        typedmess(&x->te_pd, gensym("rename"), natom2-1, vec2+1);
-		        binbuf_free(x->te_binbuf);
-		        x->te_binbuf = b;
-				//canvas_apply_restore_original_position(glist_getcanvas(glist), pos);
-			} else {
-				//just retext it
-				t_rtext *yr = glist_findrtext(glist, x);
-				if (yr) rtext_retext(yr);
-			}
+            //fprintf(stderr,"setto canvas\n");
+            //first check if the contents have changed to see if there is
+            //any point of recreating the object
+            binbuf_gettext(x->te_binbuf, &c1, &i1);
+            binbuf_gettext(b, &c2, &i2);
+            if (strcmp(c1, c2))
+            {
+                //fprintf(stderr,"string differs\n");
+                canvas_undo_add(glist_getcanvas(glist), 10, "recreate",
+                    (void *)canvas_undo_set_recreate(glist_getcanvas(glist),
+                    &x->te_g, pos));
+                typedmess(&x->te_pd, gensym("rename"), natom2-1, vec2+1);
+                binbuf_free(x->te_binbuf);
+                x->te_binbuf = b;
+                //canvas_apply_restore_original_position(glist_getcanvas(glist),
+                //    pos);
+            }
+            else
+            {
+                //just retext it
+                t_rtext *yr = glist_findrtext(glist, x);
+                if (yr) rtext_retext(yr);
+            }
         }
         else  /* normally, just destroy the old one and make a new one. */
         {
-			//first check if the contents have changed to see if there is any point of recreating the object
-			//fprintf(stderr,"setto not canvas\n");
-			binbuf_gettext(x->te_binbuf, &c1, &i1);
-			binbuf_gettext(b, &c2, &i2);
-			if (strcmp(c1, c2)) {
-				//fprintf(stderr,"text_setto calls canvas_undo_add\n");
-				canvas_undo_add(glist_getcanvas(glist), 10, "recreate",
-					(void *)canvas_undo_set_recreate(glist_getcanvas(glist), &x->te_g, pos));
-		        int xwas = x->te_xpix, ywas = x->te_ypix;
-				canvas_eraselinesfor(glist, x);
-		        glist_delete(glist, &x->te_g);
-		        canvas_objtext(glist, xwas, ywas, widthwas, 0, b);
-		            /* if it's an abstraction loadbang it here */
-		        if (newest && pd_class(newest) == canvas_class)
-		            canvas_loadbang((t_canvas *)newest);
-		        canvas_restoreconnections(glist_getcanvas(glist));
-				glob_preset_node_list_seek_hub();
-				//canvas_apply_restore_original_position(glist_getcanvas(glist), pos);
-			} else {
-				//fprintf(stderr,"just retext it\n");
-				t_rtext *yr = glist_findrtext(glist, x);
-				if (yr) rtext_retext(yr);
-			}
+            //first check if the contents have changed to see if there
+            //is any point of recreating the object
+            //fprintf(stderr,"setto not canvas\n");
+            binbuf_gettext(x->te_binbuf, &c1, &i1);
+            binbuf_gettext(b, &c2, &i2);
+            if (strcmp(c1, c2))
+            {
+                //fprintf(stderr,"text_setto calls canvas_undo_add\n");
+                canvas_undo_add(glist_getcanvas(glist), 10, "recreate",
+                    (void *)canvas_undo_set_recreate(glist_getcanvas(glist),
+                    &x->te_g, pos));
+                int xwas = x->te_xpix, ywas = x->te_ypix;
+                canvas_eraselinesfor(glist, x);
+                glist_delete(glist, &x->te_g);
+                canvas_objtext(glist, xwas, ywas, widthwas, 0, b);
+                    /* if it's an abstraction loadbang it here */
+                if (newest && pd_class(newest) == canvas_class)
+                    canvas_loadbang((t_canvas *)newest);
+                canvas_restoreconnections(glist_getcanvas(glist));
+                glob_preset_node_list_seek_hub();
+                //canvas_apply_restore_original_position(glist_getcanvas(glist),
+                //    pos);
+            }
+            else
+            {
+                //fprintf(stderr,"just retext it\n");
+                t_rtext *yr = glist_findrtext(glist, x);
+                if (yr) rtext_retext(yr);
+            }
         }
             /* if we made a new "pd" or changed a window name,
                 update window list */
@@ -2139,26 +2268,31 @@ void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos)
                 canvas_updatewindowlist();
     }
     else { // T_MESSAGE, T_TEXT, T_ATOM
-		if (x->te_type == T_TEXT) {
-		    char * c;
-		    for(c = buf; *c != '\0'; c++) {
-		        if(*c == '\n') {
-		            *c = '\v';
-		        }
-		    }
-		}
-		binbuf_gettext(x->te_binbuf, &c1, &i1);
-		t_binbuf *b = binbuf_new();
-		binbuf_text(b, buf, bufsize);
-		binbuf_gettext(b, &c2, &i2);
-		if (strcmp(c1, c2)) {
-			canvas_undo_add(glist_getcanvas(glist), 10, "typing",
-				(void *)canvas_undo_set_recreate(glist_getcanvas(glist), &x->te_g, pos));
-			//fprintf(stderr,"blah |%s| |%s|\n", c1, buf);
-		}
-		binbuf_text(x->te_binbuf, buf, bufsize);
-		binbuf_free(b);
-	}
+        if (x->te_type == T_TEXT)
+        {
+            char * c;
+            for(c = buf; *c != '\0'; c++)
+            {
+                if(*c == '\n')
+                {
+                    *c = '\v';
+                }
+            }
+        }
+        binbuf_gettext(x->te_binbuf, &c1, &i1);
+        t_binbuf *b = binbuf_new();
+        binbuf_text(b, buf, bufsize);
+        binbuf_gettext(b, &c2, &i2);
+        if (strcmp(c1, c2))
+        {
+            canvas_undo_add(glist_getcanvas(glist), 10, "typing",
+                (void *)canvas_undo_set_recreate(glist_getcanvas(glist),
+                &x->te_g, pos));
+            //fprintf(stderr,"blah |%s| |%s|\n", c1, buf);
+        }
+        binbuf_text(x->te_binbuf, buf, bufsize);
+        binbuf_free(b);
+    }
 }
 
     /* this gets called when amessage gets sent to an object whose creation
diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c
index 41992dcefd1d17349b551ad4912a1ccbca76dee5..518e00b5a4fa71d38b150e27dde89569c875a98a 100644
--- a/pd/src/g_toggle.c
+++ b/pd/src/g_toggle.c
@@ -38,155 +38,186 @@ static t_class *toggle_class;
 
 void toggle_draw_update(t_gobj *xgobj, t_glist *glist)
 {
-	t_toggle *x = (t_toggle *)xgobj;
-	if (x->x_gui.x_changed) {
-	    if(glist_isvisible(glist))
-	    {
-	        t_canvas *canvas=glist_getcanvas(glist);
-
-	        sys_vgui(".x%lx.c itemconfigure %lxX1 -stroke #%6.6x\n", canvas, x,
-	                 (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol);
-	        sys_vgui(".x%lx.c itemconfigure %lxX2 -stroke #%6.6x\n", canvas, x,
-	                 (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol);
-	    }
-	    x->x_gui.x_changed = 0;
-	}
+    t_toggle *x = (t_toggle *)xgobj;
+    if (x->x_gui.x_changed)
+    {
+        if(glist_isvisible(glist))
+        {
+            t_canvas *canvas=glist_getcanvas(glist);
+
+            sys_vgui(".x%lx.c itemconfigure %lxX1 -stroke #%6.6x\n", canvas, x,
+                     (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol);
+            sys_vgui(".x%lx.c itemconfigure %lxX2 -stroke #%6.6x\n", canvas, x,
+                     (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol);
+        }
+        x->x_gui.x_changed = 0;
+    }
 }
 
 void toggle_draw_new(t_toggle *x, t_glist *glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
-    int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist);
-
-	t_scalehandle *sh = (t_scalehandle *)x->x_gui.x_handle;
-	sprintf(sh->h_pathname, ".x%lx.h%lx", (t_int)canvas, (t_int)sh);
-
-	t_scalehandle *lh = (t_scalehandle *)x->x_gui.x_lhandle;
-	sprintf(lh->h_pathname, ".x%lx.h%lx", (t_int)canvas, (t_int)lh);
-
-	//if (glist_isvisible(canvas)) {
-
-		char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-
-		if(x->x_gui.x_w >= 30)
-		    w = 2;
-		if(x->x_gui.x_w >= 60)
-		    w = 3;
-		sys_vgui(".x%lx.c create prect %d %d %d %d -stroke $pd_colors(iemgui_border) -fill #%6.6x -tags {%lxBASE %lxTGL %s text iemgui border}\n",
-		         canvas, xx, yy, xx + x->x_gui.x_w, yy + 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 %d -stroke #%6.6x -tags {%lxX1 %lxTGL %s text iemgui}\n",
-		         canvas, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w-1, yy + x->x_gui.x_h-w-1, w,
-		         (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x, nlet_tag);
-		sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth %d -stroke #%6.6x -tags {%lxX2 %lxTGL %s text iemgui}\n",
-		         canvas, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w-1, yy+w+1, w,
-		         (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x, nlet_tag);
-		sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
-		         -font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxTGL %s text iemgui}\n",
-		         canvas, xx+x->x_gui.x_ldx,
-		         yy+x->x_gui.x_ldy,
-		         strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
-		         x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
-		         x->x_gui.x_lcol, x, x, nlet_tag);
-		if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist)
-		    sys_vgui(".x%lx.c create prect %d %d %d %d -stroke $pd_colors(iemgui_nlet) -tags {%lxTGL%so%d %so%d %lxTGL %s outlet iemgui}\n",
-		         canvas, xx, yy + x->x_gui.x_h-1, xx + IOWIDTH, yy + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
-		if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist)
-		    sys_vgui(".x%lx.c create prect %d %d %d %d -stroke $pd_colors(iemgui_nlet) -tags {%lxTGL%si%d %si%d %lxTGL %s inlet iemgui}\n",
-		         canvas, xx, yy, xx + IOWIDTH, yy+1, x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
-	//}
+    int w=1, xx=text_xpix(&x->x_gui.x_obj, glist),
+        yy=text_ypix(&x->x_gui.x_obj, glist);
+
+    t_scalehandle *sh = (t_scalehandle *)x->x_gui.x_handle;
+    sprintf(sh->h_pathname, ".x%lx.h%lx", (t_int)canvas, (t_int)sh);
+
+    t_scalehandle *lh = (t_scalehandle *)x->x_gui.x_lhandle;
+    sprintf(lh->h_pathname, ".x%lx.h%lx", (t_int)canvas, (t_int)lh);
+
+    //if (glist_isvisible(canvas)) {
+
+        char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
+
+        if(x->x_gui.x_w >= 30)
+            w = 2;
+        if(x->x_gui.x_w >= 60)
+            w = 3;
+        sys_vgui(".x%lx.c create prect %d %d %d %d "
+                 "-stroke $pd_colors(iemgui_border) -fill #%6.6x "
+                 "-tags {%lxBASE %lxTGL %s text iemgui border}\n",
+                 canvas, xx, yy, xx + x->x_gui.x_w, yy + 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 %d -stroke #%6.6x "
+                 "-tags {%lxX1 %lxTGL %s text iemgui}\n",
+                 canvas, xx+w+1, yy+w+1,
+                 xx + x->x_gui.x_w-w-1, yy + x->x_gui.x_h-w-1, w,
+                 (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x,
+                 nlet_tag);
+        sys_vgui(".x%lx.c create polyline %d %d %d %d "
+                 "-strokewidth %d -stroke #%6.6x "
+                 "-tags {%lxX2 %lxTGL %s text iemgui}\n",
+                 canvas, xx+w+1, yy + x->x_gui.x_h-w-1,
+                 xx + x->x_gui.x_w-w-1, yy+w+1, w,
+                 (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x, nlet_tag);
+        sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w "
+                 "-font {{%s} -%d %s} -fill #%6.6x "
+                 "-tags {%lxLABEL %lxTGL %s text iemgui}\n",
+                 canvas, xx+x->x_gui.x_ldx,
+                 yy+x->x_gui.x_ldy,
+                 strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
+                 x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
+                 x->x_gui.x_lcol, x, x, nlet_tag);
+        if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist)
+            sys_vgui(".x%lx.c create prect %d %d %d %d "
+                     "-stroke $pd_colors(iemgui_nlet) "
+                     "-tags {%lxTGL%so%d %so%d %lxTGL %s outlet iemgui}\n",
+                 canvas, xx, yy + x->x_gui.x_h-1,
+                 xx + IOWIDTH, yy + x->x_gui.x_h,
+                 x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
+        if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist)
+            sys_vgui(".x%lx.c create prect %d %d %d %d "
+                     "-stroke $pd_colors(iemgui_nlet) "
+                     "-tags {%lxTGL%si%d %si%d %lxTGL %s inlet iemgui}\n",
+                 canvas, xx, yy, xx + IOWIDTH, yy+1,
+                 x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
+    //}
 }
 
 void toggle_draw_move(t_toggle *x, t_glist *glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
-    int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist);
-
-	if (glist_isvisible(canvas)) {
-
-		char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-
-		if(x->x_gui.x_w >= 30)
-		    w = 2;
-
-		if(x->x_gui.x_w >= 60)
-		    w = 3;
-		sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n",
-		         canvas, x, xx, yy, xx + x->x_gui.x_w, yy + x->x_gui.x_h);
-		sys_vgui(".x%lx.c itemconfigure %lxX1 -strokewidth %d\n", canvas, x, w);
-		sys_vgui(".x%lx.c coords %lxX1 %d %d %d %d\n",
-		         canvas, x, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w-1, yy + x->x_gui.x_h-w-1);
-		sys_vgui(".x%lx.c itemconfigure %lxX2 -strokewidth %d\n", canvas, x, w);
-		sys_vgui(".x%lx.c coords %lxX2 %d %d %d %d\n",
-		         canvas, x, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w-1, yy+w+1);
-		sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
-		         canvas, x, xx+x->x_gui.x_ldx, yy+x->x_gui.x_ldy);
-		if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist)
-		    sys_vgui(".x%lx.c coords %lxTGL%so%d %d %d %d %d\n",
-		         canvas, x, nlet_tag, 0, xx, yy + x->x_gui.x_h-1, xx + IOWIDTH, yy + x->x_gui.x_h);
-		if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist)
-		    sys_vgui(".x%lx.c coords %lxTGL%si%d %d %d %d %d\n",
-		         canvas, x, nlet_tag, 0, xx, yy, xx + IOWIDTH, yy+1);
-		/* redraw scale handle rectangle if selected */
-		if (x->x_gui.x_fsf.x_selected)
-			toggle_draw_select(x, x->x_gui.x_glist);
-	}
+    int w=1, xx=text_xpix(&x->x_gui.x_obj, glist),
+        yy=text_ypix(&x->x_gui.x_obj, glist);
+
+    if (glist_isvisible(canvas))
+    {
+
+        char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
+
+        if(x->x_gui.x_w >= 30)
+            w = 2;
+
+        if(x->x_gui.x_w >= 60)
+            w = 3;
+        sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n",
+                 canvas, x, xx, yy, xx + x->x_gui.x_w, yy + x->x_gui.x_h);
+        sys_vgui(".x%lx.c itemconfigure %lxX1 -strokewidth %d\n", canvas, x, w);
+        sys_vgui(".x%lx.c coords %lxX1 %d %d %d %d\n",
+                 canvas, x, xx+w+1, yy+w+1,
+                 xx + x->x_gui.x_w-w-1, yy + x->x_gui.x_h-w-1);
+        sys_vgui(".x%lx.c itemconfigure %lxX2 -strokewidth %d\n", canvas, x, w);
+        sys_vgui(".x%lx.c coords %lxX2 %d %d %d %d\n",
+                 canvas, x, xx+w+1,
+                 yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w-1, yy+w+1);
+        sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
+                 canvas, x, xx+x->x_gui.x_ldx, yy+x->x_gui.x_ldy);
+        if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist)
+            sys_vgui(".x%lx.c coords %lxTGL%so%d %d %d %d %d\n",
+                 canvas, x, nlet_tag, 0, xx,
+                 yy + x->x_gui.x_h-1, xx + IOWIDTH, yy + x->x_gui.x_h);
+        if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist)
+            sys_vgui(".x%lx.c coords %lxTGL%si%d %d %d %d %d\n",
+                 canvas, x, nlet_tag, 0, xx, yy, xx + IOWIDTH, yy+1);
+        /* redraw scale handle rectangle if selected */
+        if (x->x_gui.x_fsf.x_selected)
+            toggle_draw_select(x, x->x_gui.x_glist);
+    }
 }
 
 void toggle_draw_erase(t_toggle* x, t_glist* glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
 
-	sys_vgui(".x%lx.c delete %lxTGL\n", canvas, x);
-	sys_vgui(".x%lx.c dtag all %lxTGL\n", canvas, x);
-	if (x->x_gui.x_fsf.x_selected) {
-		t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
-		sys_vgui("destroy %s\n", sh->h_pathname);
-		sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
-		t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
-		sys_vgui("destroy %s\n", lh->h_pathname);
-		sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
-	}
+    sys_vgui(".x%lx.c delete %lxTGL\n", canvas, x);
+    sys_vgui(".x%lx.c dtag all %lxTGL\n", canvas, x);
+    if (x->x_gui.x_fsf.x_selected)
+    {
+        t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
+        sys_vgui("destroy %s\n", sh->h_pathname);
+        sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
+        t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
+        sys_vgui("destroy %s\n", lh->h_pathname);
+        sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
+    }
 }
 
 void toggle_draw_config(t_toggle* x, t_glist* glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
 
-	/*
-	char color[64];
-	if (x->x_gui.x_fsf.x_selected)
-		sprintf(color, "$pd_colors(selection)");
-	else
-		sprintf(color, "#%6.6x", x->x_gui.x_lcol); 
-
+    /*
+    char color[64];
+    if (x->x_gui.x_fsf.x_selected)
+        sprintf(color, "$pd_colors(selection)");
+    else
+        sprintf(color, "#%6.6x", x->x_gui.x_lcol); 
 
-    sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} %d %s} -fill %s -text {%s} \n",
+    sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} %d %s} "
+             "-fill %s -text {%s} \n",
              canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
              color,
              strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"");
-	*/
-	if (x->x_gui.x_fsf.x_selected && x->x_gui.x_glist == canvas) {
-    	sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill $pd_colors(selection) -text {%s} \n",
+    */
+    if (x->x_gui.x_fsf.x_selected && x->x_gui.x_glist == canvas)
+    {
+        sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} "
+                 "-fill $pd_colors(selection) -text {%s} \n",
              canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
              strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"");
-	}
-	else {
-    	sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n",
+    }
+    else
+    {
+        sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} "
+                 "-fill #%6.6x -text {%s} \n",
              canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
-			 x->x_gui.x_lcol,
+             x->x_gui.x_lcol,
              strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"");
-	}
-    sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n .x%lx.c itemconfigure %lxX1 -stroke #%6.6x\n .x%lx.c itemconfigure %lxX2 -stroke #%6.6x\n", canvas, x,
-             x->x_gui.x_bcol , canvas, x,
+    }
+    sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n "
+             ".x%lx.c itemconfigure %lxX1 -stroke #%6.6x\n "
+             ".x%lx.c itemconfigure %lxX2 -stroke #%6.6x\n",
+             canvas, x, x->x_gui.x_bcol , canvas, x,
              x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol, canvas, x,
              x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol);
-	/*
+    /*
     sys_vgui(".x%lx.c itemconfigure %lxX1 -fill #%6.6x\n", canvas, x,
              x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol);
     sys_vgui(".x%lx.c itemconfigure %lxX2 -fill #%6.6x\n", canvas, x,
              x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol);
-	*/
+    */
 }
 
 void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags)
@@ -195,318 +226,378 @@ void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags)
     int ypos=text_ypix(&x->x_gui.x_obj, glist);
     t_canvas *canvas=glist_getcanvas(glist);
 
-	if (glist_isvisible(canvas) && canvas == x->x_gui.x_glist) {
-
-		char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-
-		if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able)
-		    sys_vgui(".x%lx.c create prect %d %d %d %d -stroke $pd_colors(iemgui_nlet) -tags {%lxTGL%so%d %so%d %lxTGL %s outlet iemgui}\n",
-		         canvas, xpos,
-		         ypos + x->x_gui.x_h-1, xpos + IOWIDTH,
-		         ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
-		if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able)
-		    sys_vgui(".x%lx.c delete %lxTGL%so%d\n", canvas, x, nlet_tag, 0);
-		if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able)
-		    sys_vgui(".x%lx.c create prect %d %d %d %d -stroke $pd_colors(iemgui_nlet) -tags {%lxTGL%si%d %si%d %lxTGL %s inlet iemgui}\n",
-		         canvas, xpos, ypos,
-		         xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
-		if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
-		    sys_vgui(".x%lx.c delete %lxTGL%si%d\n", canvas, x, nlet_tag, 0);
-	}
+    if (glist_isvisible(canvas) && canvas == x->x_gui.x_glist)
+    {
+        char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
+
+        if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) &&
+            !x->x_gui.x_fsf.x_snd_able)
+            sys_vgui(".x%lx.c create prect %d %d %d %d "
+                     "-stroke $pd_colors(iemgui_nlet) "
+                     "-tags {%lxTGL%so%d %so%d %lxTGL %s outlet iemgui}\n",
+                 canvas, xpos,
+                 ypos + x->x_gui.x_h-1, xpos + IOWIDTH,
+                 ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
+        if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) &&
+            x->x_gui.x_fsf.x_snd_able)
+            sys_vgui(".x%lx.c delete %lxTGL%so%d\n", canvas, x, nlet_tag, 0);
+        if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) &&
+            !x->x_gui.x_fsf.x_rcv_able)
+            sys_vgui(".x%lx.c create prect %d %d %d %d "
+                     "-stroke $pd_colors(iemgui_nlet) "
+                     "-tags {%lxTGL%si%d %si%d %lxTGL %s inlet iemgui}\n",
+                 canvas, xpos, ypos,
+                 xpos + IOWIDTH, ypos+1, x,
+                 nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
+        if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) &&
+            x->x_gui.x_fsf.x_rcv_able)
+            sys_vgui(".x%lx.c delete %lxTGL%si%d\n", canvas, x, nlet_tag, 0);
+    }
 }
 
 void toggle_draw_select(t_toggle* x, t_glist* glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
-	t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
-	t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
-
-	//if (glist_isvisible(canvas)) {
-
-		if(x->x_gui.x_fsf.x_selected)
-		{
-
-			// check if we are drawing inside a gop abstraction visible on parent canvas
-			// if so, disable highlighting
-			if (x->x_gui.x_glist == glist_getcanvas(glist)) {
-
-			char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
-
-		    sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke $pd_colors(selection)\n", canvas, x);
-		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $pd_colors(selection)\n", canvas, x);
-
-				if (x->x_gui.scale_vis) {
-					sys_vgui("destroy %s\n", sh->h_pathname);
-					sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
-				}
-
-				sys_vgui("canvas %s -width %d -height %d -bg $pd_colors(selection) -bd 0 -cursor bottom_right_corner\n",
-					 sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
-				sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxTGL %s}\n",
-					 canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
-					 x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
-					 SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
-					 sh->h_pathname, x, x, nlet_tag);
-				sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-					 sh->h_pathname, sh->h_bindsym->s_name);
-				sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-					 sh->h_pathname, sh->h_bindsym->s_name);
-				sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-					 sh->h_pathname, sh->h_bindsym->s_name);
-				x->x_gui.scale_vis = 1;
-
-				if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
-				{
-					if (x->x_gui.label_vis) {
-						sys_vgui("destroy %s\n", lh->h_pathname);
-						sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
-					}
-
-					sys_vgui("canvas %s -width %d -height %d -bg $pd_colors(selection) -bd 0 -cursor crosshair\n",
-						lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
-					sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxLABELH %lxTGL %s}\n",
-						canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
-						x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
-						LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
-						lh->h_pathname, x, x, x, nlet_tag);
-					sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
-						lh->h_pathname, lh->h_bindsym->s_name);
-					sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
-						lh->h_pathname, lh->h_bindsym->s_name);
-					sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
-						lh->h_pathname, lh->h_bindsym->s_name);
-					x->x_gui.label_vis = 1;
-				}
-			}
-
-			sys_vgui(".x%lx.c addtag selected withtag %lxTGL\n", canvas, x);
-		}
-		else
-		{
-		    sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke %s\n", canvas, x, IEM_GUI_COLOR_NORMAL);
-		    sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol);
-			sys_vgui(".x%lx.c dtag %lxTGL selected\n", canvas, x);
-			sys_vgui("destroy %s\n", sh->h_pathname);
-			sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
-			x->x_gui.scale_vis = 0;
-			sys_vgui("destroy %s\n", lh->h_pathname);
-			sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
-			x->x_gui.label_vis = 0;
-		}
-	//}
+    t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
+    t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
+
+    //if (glist_isvisible(canvas)) {
+
+        if(x->x_gui.x_fsf.x_selected)
+        {
+
+            // check if we are drawing inside a gop abstraction
+            // visible on parent canvas
+            // if so, disable highlighting
+            if (x->x_gui.x_glist == glist_getcanvas(glist))
+            {
+
+            char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
+
+            sys_vgui(".x%lx.c itemconfigure %lxBASE "
+                     "-stroke $pd_colors(selection)\n", canvas, x);
+            sys_vgui(".x%lx.c itemconfigure %lxLABEL "
+                     "-fill $pd_colors(selection)\n", canvas, x);
+
+                if (x->x_gui.scale_vis)
+                {
+                    sys_vgui("destroy %s\n", sh->h_pathname);
+                    sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
+                }
+
+                sys_vgui("canvas %s -width %d -height %d "
+                         "-bg $pd_colors(selection) -bd 0 "
+                         "-cursor bottom_right_corner\n",
+                     sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
+                sys_vgui(".x%x.c create window %d %d -anchor nw "
+                         "-width %d -height %d -window %s "
+                         "-tags {%lxSCALE %lxTGL %s}\n",
+                     canvas,
+                     x->x_gui.x_obj.te_xpix + x->x_gui.x_w -
+                         SCALEHANDLE_WIDTH - 1,
+                     x->x_gui.x_obj.te_ypix + x->x_gui.x_h -
+                         SCALEHANDLE_HEIGHT - 1,
+                     SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
+                     sh->h_pathname, x, x, nlet_tag);
+                sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+                     sh->h_pathname, sh->h_bindsym->s_name);
+                sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+                     sh->h_pathname, sh->h_bindsym->s_name);
+                sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+                     sh->h_pathname, sh->h_bindsym->s_name);
+                x->x_gui.scale_vis = 1;
+
+                if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
+                {
+                    if (x->x_gui.label_vis)
+                    {
+                        sys_vgui("destroy %s\n", lh->h_pathname);
+                        sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
+                    }
+
+                    sys_vgui("canvas %s -width %d -height %d "
+                             "-bg $pd_colors(selection) -bd 0 "
+                             "-cursor crosshair\n",
+                        lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
+                    sys_vgui(".x%x.c create window %d %d -anchor nw "
+                             "-width %d -height %d -window %s "
+                             "-tags {%lxLABEL %lxLABELH %lxTGL %s}\n",
+                        canvas,
+                        x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx -
+                            LABELHANDLE_WIDTH,
+                        x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy -
+                            LABELHANDLE_HEIGHT,
+                        LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
+                        lh->h_pathname, x, x, x, nlet_tag);
+                    sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
+                        lh->h_pathname, lh->h_bindsym->s_name);
+                    sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
+                        lh->h_pathname, lh->h_bindsym->s_name);
+                    sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
+                        lh->h_pathname, lh->h_bindsym->s_name);
+                    x->x_gui.label_vis = 1;
+                }
+            }
+
+            sys_vgui(".x%lx.c addtag selected withtag %lxTGL\n", canvas, x);
+        }
+        else
+        {
+            sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke %s\n",
+                canvas, x, IEM_GUI_COLOR_NORMAL);
+            sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n",
+                canvas, x, x->x_gui.x_lcol);
+            sys_vgui(".x%lx.c dtag %lxTGL selected\n", canvas, x);
+            sys_vgui("destroy %s\n", sh->h_pathname);
+            sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
+            x->x_gui.scale_vis = 0;
+            sys_vgui("destroy %s\n", lh->h_pathname);
+            sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
+            x->x_gui.label_vis = 0;
+        }
+    //}
 }
 
-static void toggle__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_floatarg yyy)
+static void toggle__clickhook(t_scalehandle *sh, t_floatarg f,
+    t_floatarg xxx, t_floatarg yyy)
 {
 
-	t_toggle *x = (t_toggle *)(sh->h_master);
+    t_toggle *x = (t_toggle *)(sh->h_master);
 
-	if (xxx) {
-		x->x_gui.scale_offset_x = xxx;
-		x->x_gui.label_offset_x = xxx;
-	}
-	if (yyy) {
-		x->x_gui.scale_offset_y = yyy;
-		x->x_gui.label_offset_y = yyy;
-	}
+    if (xxx)
+    {
+        x->x_gui.scale_offset_x = xxx;
+        x->x_gui.label_offset_x = xxx;
+    }
+    if (yyy)
+    {
+        x->x_gui.scale_offset_y = yyy;
+        x->x_gui.label_offset_y = yyy;
+    }
 
     int newstate = (int)f;
     if (sh->h_dragon && newstate == 0 && sh->h_scale)
     {
-		/* done dragging */
-
-		/* first set up the undo apply */
-		canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
-
-		if (sh->h_dragx || sh->h_dragy) {
-
-			if (sh->h_dragx > sh->h_dragy)
-				sh->h_dragx = sh->h_dragy;
-			else sh->h_dragy = sh->h_dragx;
-
-			x->x_gui.x_w = x->x_gui.x_w + sh->h_dragx - x->x_gui.scale_offset_x;
-			if (x->x_gui.x_w < SCALE_TGL_MINWIDTH)
-				x->x_gui.x_w = SCALE_TGL_MINWIDTH;
-			x->x_gui.x_h = x->x_gui.x_h + sh->h_dragy - x->x_gui.scale_offset_y;
-			if (x->x_gui.x_h < SCALE_TGL_MINHEIGHT)
-				x->x_gui.x_h = SCALE_TGL_MINHEIGHT;
-
-			canvas_dirty(x->x_gui.x_glist, 1);
-		}
-
-		int properties = gfxstub_haveproperties((void *)x);
-
-		if (properties) {
-			sys_vgui(".gfxstub%lx.dim.w_ent delete 0 end\n", properties);
-			sys_vgui(".gfxstub%lx.dim.w_ent insert 0 %d\n", properties, x->x_gui.x_w);
-			//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
-			//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties, x->x_gui.x_h);
-		}
-
-		if (glist_isvisible(x->x_gui.x_glist))
-		{
-			sys_vgui(".x%x.c delete %s\n", x->x_gui.x_glist, sh->h_outlinetag);
-			toggle_draw_move(x, x->x_gui.x_glist);
-			iemgui_select((t_gobj *)x, x->x_gui.x_glist, 1);
-			canvas_fixlinesfor(x->x_gui.x_glist, (t_text *)x);
-			sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x->x_gui.x_glist);
-		}
+        /* done dragging */
+
+        /* first set up the undo apply */
+        canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
+
+        if (sh->h_dragx || sh->h_dragy)
+        {
+
+            if (sh->h_dragx > sh->h_dragy)
+                sh->h_dragx = sh->h_dragy;
+            else sh->h_dragy = sh->h_dragx;
+
+            x->x_gui.x_w = x->x_gui.x_w + sh->h_dragx - x->x_gui.scale_offset_x;
+            if (x->x_gui.x_w < SCALE_TGL_MINWIDTH)
+                x->x_gui.x_w = SCALE_TGL_MINWIDTH;
+            x->x_gui.x_h = x->x_gui.x_h + sh->h_dragy - x->x_gui.scale_offset_y;
+            if (x->x_gui.x_h < SCALE_TGL_MINHEIGHT)
+                x->x_gui.x_h = SCALE_TGL_MINHEIGHT;
+
+            canvas_dirty(x->x_gui.x_glist, 1);
+        }
+
+        int properties = gfxstub_haveproperties((void *)x);
+
+        if (properties)
+        {
+            sys_vgui(".gfxstub%lx.dim.w_ent delete 0 end\n", properties);
+            sys_vgui(".gfxstub%lx.dim.w_ent insert 0 %d\n", properties,
+                x->x_gui.x_w);
+            //sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
+            //sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties,
+            //    x->x_gui.x_h);
+        }
+
+        if (glist_isvisible(x->x_gui.x_glist))
+        {
+            sys_vgui(".x%x.c delete %s\n", x->x_gui.x_glist, sh->h_outlinetag);
+            toggle_draw_move(x, x->x_gui.x_glist);
+            iemgui_select((t_gobj *)x, x->x_gui.x_glist, 1);
+            canvas_fixlinesfor(x->x_gui.x_glist, (t_text *)x);
+            sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x->x_gui.x_glist);
+        }
     }
     else if (!sh->h_dragon && newstate && sh->h_scale)
     {
-		/* dragging */
-		if (glist_isvisible(x->x_gui.x_glist))
-		{
-			sys_vgui("lower %s\n", sh->h_pathname);
-			sys_vgui(".x%x.c create prect %d %d %d %d\
-	 -stroke $pd_colors(selection) -strokewidth 1 -tags %s\n",
-				 x->x_gui.x_glist, x->x_gui.x_obj.te_xpix, x->x_gui.x_obj.te_ypix,
-					x->x_gui.x_obj.te_xpix + x->x_gui.x_w,
-					x->x_gui.x_obj.te_ypix + x->x_gui.x_h, sh->h_outlinetag);
-		}
-
-		sh->h_dragx = 0;
-		sh->h_dragy = 0;
+        /* dragging */
+        if (glist_isvisible(x->x_gui.x_glist))
+        {
+            sys_vgui("lower %s\n", sh->h_pathname);
+            sys_vgui(".x%x.c create prect %d %d %d %d "
+                     "-stroke $pd_colors(selection) -strokewidth 1 -tags %s\n",
+                x->x_gui.x_glist, x->x_gui.x_obj.te_xpix,
+                x->x_gui.x_obj.te_ypix,
+                x->x_gui.x_obj.te_xpix + x->x_gui.x_w,
+                x->x_gui.x_obj.te_ypix + x->x_gui.x_h, sh->h_outlinetag);
+        }
+
+        sh->h_dragx = 0;
+        sh->h_dragy = 0;
+    }
+    else if (sh->h_dragon && !newstate && !sh->h_scale)
+    {
+        /* done dragging */
+
+        /* first set up the undo apply */
+        canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
+
+        if (sh->h_dragx || sh->h_dragy)
+        {
+
+            x->x_gui.x_ldx =
+                x->x_gui.x_ldx + sh->h_dragx - x->x_gui.label_offset_x;
+            x->x_gui.x_ldy =
+                x->x_gui.x_ldy + sh->h_dragy - x->x_gui.label_offset_y;
+
+            canvas_dirty(x->x_gui.x_glist, 1);
+        }
+
+        int properties = gfxstub_haveproperties((void *)x);
+
+        if (properties)
+        {
+            sys_vgui(".gfxstub%lx.dim.w_ent delete 0 end\n", properties);
+            sys_vgui(".gfxstub%lx.dim.w_ent insert 0 %d\n", properties,
+                x->x_gui.x_w);
+            //sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
+            //sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties,
+            //    x->x_gui.x_h);
+        }
+
+        if (glist_isvisible(x->x_gui.x_glist))
+        {
+            sys_vgui(".x%x.c delete %s\n", x->x_gui.x_glist, sh->h_outlinetag);
+            toggle_draw_move(x, x->x_gui.x_glist);
+            iemgui_select((t_gobj *)x, x->x_gui.x_glist, 1);
+            canvas_fixlinesfor(x->x_gui.x_glist, (t_text *)x);
+            sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x->x_gui.x_glist);
+        }
+    }
+    else if(!sh->h_dragon && newstate && !sh->h_scale)
+    {
+        /* dragging */
+        if (glist_isvisible(x->x_gui.x_glist))
+        {
+            sys_vgui("lower %s\n", sh->h_pathname);
+            t_scalehandle *othersh = (t_scalehandle *)x->x_gui.x_handle;
+            sys_vgui("lower .x%lx.h%lx\n",
+                (t_int)glist_getcanvas(x->x_gui.x_glist), (t_int)othersh);
+        }
+
+        sh->h_dragx = 0;
+        sh->h_dragy = 0;
     }
-	else if (sh->h_dragon && !newstate && !sh->h_scale)
-	{
-		/* done dragging */
-
-		/* first set up the undo apply */
-		canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
-
-		if (sh->h_dragx || sh->h_dragy) {
-
-			x->x_gui.x_ldx = x->x_gui.x_ldx + sh->h_dragx - x->x_gui.label_offset_x;
-			x->x_gui.x_ldy = x->x_gui.x_ldy + sh->h_dragy - x->x_gui.label_offset_y;
-
-			canvas_dirty(x->x_gui.x_glist, 1);
-		}
-
-		int properties = gfxstub_haveproperties((void *)x);
-
-		if (properties) {
-			sys_vgui(".gfxstub%lx.dim.w_ent delete 0 end\n", properties);
-			sys_vgui(".gfxstub%lx.dim.w_ent insert 0 %d\n", properties, x->x_gui.x_w);
-			//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
-			//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties, x->x_gui.x_h);
-		}
-
-		if (glist_isvisible(x->x_gui.x_glist))
-		{
-			sys_vgui(".x%x.c delete %s\n", x->x_gui.x_glist, sh->h_outlinetag);
-			toggle_draw_move(x, x->x_gui.x_glist);
-			iemgui_select((t_gobj *)x, x->x_gui.x_glist, 1);
-			canvas_fixlinesfor(x->x_gui.x_glist, (t_text *)x);
-			sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x->x_gui.x_glist);
-		}
-	}
-	else if(!sh->h_dragon && newstate && !sh->h_scale)
-	{
-		/* dragging */
-		if (glist_isvisible(x->x_gui.x_glist)) {
-			sys_vgui("lower %s\n", sh->h_pathname);
-			t_scalehandle *othersh = (t_scalehandle *)x->x_gui.x_handle;
-			sys_vgui("lower .x%lx.h%lx\n", (t_int)glist_getcanvas(x->x_gui.x_glist), (t_int)othersh);
-		}
-
-		sh->h_dragx = 0;
-		sh->h_dragy = 0;
-	}
 
     sh->h_dragon = newstate;
 }
 
-static void toggle__motionhook(t_scalehandle *sh,
-				    t_floatarg f1, t_floatarg f2)
+static void toggle__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2)
 {
     if (sh->h_dragon && sh->h_scale)
     {
-		t_toggle *x = (t_toggle *)(sh->h_master);
-		int dx = (int)f1, dy = (int)f2;
-		int newx, newy;
-
-		if (dx > dy) {
-			dx = dy;
-			x->x_gui.scale_offset_x = x->x_gui.scale_offset_y;
-		}
-		else {
-			dy = dx;
-			x->x_gui.scale_offset_y = x->x_gui.scale_offset_x;
-		}
-
-		newx = x->x_gui.x_obj.te_xpix + x->x_gui.x_w - x->x_gui.scale_offset_x + dx;
-		newy = x->x_gui.x_obj.te_ypix + x->x_gui.x_h - x->x_gui.scale_offset_y + dy;
-
-		if (newx < x->x_gui.x_obj.te_xpix + SCALE_TGL_MINWIDTH)
-			newx = x->x_gui.x_obj.te_xpix + SCALE_TGL_MINWIDTH;
-		if (newy < x->x_gui.x_obj.te_ypix + SCALE_TGL_MINHEIGHT)
-			newy = x->x_gui.x_obj.te_ypix + SCALE_TGL_MINHEIGHT;
-
-		if (glist_isvisible(x->x_gui.x_glist)) {
-			sys_vgui(".x%x.c coords %s %d %d %d %d\n",
-				 x->x_gui.x_glist, sh->h_outlinetag, x->x_gui.x_obj.te_xpix,
-				 x->x_gui.x_obj.te_ypix, newx, newy);
-		}
-		sh->h_dragx = dx;
-		sh->h_dragy = dy;
-
-		int properties = gfxstub_haveproperties((void *)x);
-
-		if (properties) {
-			int new_w = x->x_gui.x_w - x->x_gui.scale_offset_x + sh->h_dragx;
-			int new_h = x->x_gui.x_h - x->x_gui.scale_offset_y + sh->h_dragy;
-			sys_vgui(".gfxstub%lx.dim.w_ent delete 0 end\n", properties);
-			sys_vgui(".gfxstub%lx.dim.w_ent insert 0 %d\n", properties, new_w);
-			//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
-			//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties, new_h);
-		}
+        t_toggle *x = (t_toggle *)(sh->h_master);
+        int dx = (int)f1, dy = (int)f2;
+        int newx, newy;
+
+        if (dx > dy)
+        {
+            dx = dy;
+            x->x_gui.scale_offset_x = x->x_gui.scale_offset_y;
+        }
+        else
+        {
+            dy = dx;
+            x->x_gui.scale_offset_y = x->x_gui.scale_offset_x;
+        }
+
+        newx = x->x_gui.x_obj.te_xpix + x->x_gui.x_w -
+            x->x_gui.scale_offset_x + dx;
+        newy = x->x_gui.x_obj.te_ypix + x->x_gui.x_h -
+            x->x_gui.scale_offset_y + dy;
+
+        if (newx < x->x_gui.x_obj.te_xpix + SCALE_TGL_MINWIDTH)
+            newx = x->x_gui.x_obj.te_xpix + SCALE_TGL_MINWIDTH;
+        if (newy < x->x_gui.x_obj.te_ypix + SCALE_TGL_MINHEIGHT)
+            newy = x->x_gui.x_obj.te_ypix + SCALE_TGL_MINHEIGHT;
+
+        if (glist_isvisible(x->x_gui.x_glist))
+        {
+            sys_vgui(".x%x.c coords %s %d %d %d %d\n",
+                 x->x_gui.x_glist, sh->h_outlinetag, x->x_gui.x_obj.te_xpix,
+                 x->x_gui.x_obj.te_ypix, newx, newy);
+        }
+        sh->h_dragx = dx;
+        sh->h_dragy = dy;
+
+        int properties = gfxstub_haveproperties((void *)x);
+
+        if (properties)
+        {
+            int new_w = x->x_gui.x_w - x->x_gui.scale_offset_x + sh->h_dragx;
+            int new_h = x->x_gui.x_h - x->x_gui.scale_offset_y + sh->h_dragy;
+            sys_vgui(".gfxstub%lx.dim.w_ent delete 0 end\n", properties);
+            sys_vgui(".gfxstub%lx.dim.w_ent insert 0 %d\n", properties, new_w);
+            //sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
+            //sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties, new_h);
+        }
+    }
+    else if (sh->h_dragon && !sh->h_scale)
+    {
+        t_bng *x = (t_bng *)(sh->h_master);
+        int dx = (int)f1, dy = (int)f2;
+        int newx, newy;
+        newx = x->x_gui.x_obj.te_xpix + x->x_gui.x_w -
+            x->x_gui.scale_offset_x + dx;
+        newy = x->x_gui.x_obj.te_ypix + x->x_gui.x_h -
+            x->x_gui.scale_offset_y + dy;
+
+        sh->h_dragx = dx;
+        sh->h_dragy = dy;
+
+        int properties = gfxstub_haveproperties((void *)x);
+
+        if (properties)
+        {
+            int new_x = x->x_gui.x_ldx - x->x_gui.label_offset_x + sh->h_dragx;
+            int new_y = x->x_gui.x_ldy - x->x_gui.label_offset_y + sh->h_dragy;
+            sys_vgui(".gfxstub%lx.label.xy.x_entry delete 0 end\n", properties);
+            sys_vgui(".gfxstub%lx.label.xy.x_entry insert 0 %d\n", properties,
+                new_x);
+            sys_vgui(".gfxstub%lx.label.xy.y_entry delete 0 end\n", properties);
+            sys_vgui(".gfxstub%lx.label.xy.y_entry insert 0 %d\n", properties,
+                new_y);
+        }
+
+        if (glist_isvisible(x->x_gui.x_glist))
+        {
+            int xpos=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
+            int ypos=text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
+            t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist);
+            sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
+                canvas, x,
+                xpos+x->x_gui.x_ldx + sh->h_dragx - x->x_gui.label_offset_x,
+                ypos+x->x_gui.x_ldy + sh->h_dragy - x->x_gui.label_offset_y);
+        }
     }
-	else if (sh->h_dragon && !sh->h_scale)
-	{
-		t_bng *x = (t_bng *)(sh->h_master);
-		int dx = (int)f1, dy = (int)f2;
-		int newx, newy;
-		newx = x->x_gui.x_obj.te_xpix + x->x_gui.x_w - x->x_gui.scale_offset_x + dx;
-		newy = x->x_gui.x_obj.te_ypix + x->x_gui.x_h - x->x_gui.scale_offset_y + dy;
-
-		sh->h_dragx = dx;
-		sh->h_dragy = dy;
-
-		int properties = gfxstub_haveproperties((void *)x);
-
-		if (properties) {
-			int new_x = x->x_gui.x_ldx - x->x_gui.label_offset_x + sh->h_dragx;
-			int new_y = x->x_gui.x_ldy - x->x_gui.label_offset_y + sh->h_dragy;
-			sys_vgui(".gfxstub%lx.label.xy.x_entry delete 0 end\n", properties);
-			sys_vgui(".gfxstub%lx.label.xy.x_entry insert 0 %d\n", properties, new_x);
-			sys_vgui(".gfxstub%lx.label.xy.y_entry delete 0 end\n", properties);
-			sys_vgui(".gfxstub%lx.label.xy.y_entry insert 0 %d\n", properties, new_y);
-		}
-
-		if (glist_isvisible(x->x_gui.x_glist)) {
-			int xpos=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
-    		int ypos=text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
-    		t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist);
-			sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
- 		    	canvas, x, xpos+x->x_gui.x_ldx + sh->h_dragx - x->x_gui.label_offset_x,
- 		    	ypos+x->x_gui.x_ldy + sh->h_dragy - x->x_gui.label_offset_y);
-		}
-	}
 }
 
 
 void toggle_draw(t_toggle *x, t_glist *glist, int mode)
 {
     if(mode == IEM_GUI_DRAW_MODE_UPDATE)
-    	sys_queuegui((t_gobj*)x, x->x_gui.x_glist, toggle_draw_update);
+        sys_queuegui((t_gobj*)x, x->x_gui.x_glist, toggle_draw_update);
         //toggle_draw_update(x, glist);
     else if(mode == IEM_GUI_DRAW_MODE_MOVE)
         toggle_draw_move(x, glist);
-    else if(mode == IEM_GUI_DRAW_MODE_NEW) {
+    else if(mode == IEM_GUI_DRAW_MODE_NEW)
+    {
         toggle_draw_new(x, glist);
-		sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
-	}
+        sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
+    }
     else if(mode == IEM_GUI_DRAW_MODE_SELECT)
         toggle_draw_select(x, glist);
     else if(mode == IEM_GUI_DRAW_MODE_ERASE)
@@ -519,7 +610,8 @@ void toggle_draw(t_toggle *x, t_glist *glist, int mode)
 
 /* ------------------------ tgl widgetbehaviour----------------------------- */
 
-static void toggle_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2)
+static void toggle_getrect(t_gobj *z, t_glist *glist,
+    int *xp1, int *yp1, int *xp2, int *yp2)
 {
     t_toggle *x = (t_toggle *)z;
 
@@ -528,7 +620,7 @@ static void toggle_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *x
     *xp2 = *xp1 + x->x_gui.x_w;
     *yp2 = *yp1 + x->x_gui.x_h;
 
-	iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
+    iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
 }
 
 static void toggle_save(t_gobj *z, t_binbuf *b)
@@ -577,7 +669,7 @@ static void toggle_properties(t_gobj *z, t_glist *owner)
 
 static void toggle_bang(t_toggle *x)
 {
-	x->x_gui.x_changed = 1;
+    x->x_gui.x_changed = 1;
     x->x_on = (x->x_on==0.0)?x->x_nonzero:0.0;
     (*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);
@@ -587,7 +679,7 @@ static void toggle_bang(t_toggle *x)
 
 static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv)
 {
-	canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
+    canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x);
 
     t_symbol *srl[3];
     int a = (int)atom_getintarg(0, argc, argv);
@@ -606,31 +698,36 @@ static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv)
     (*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((void *)x, &x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
+    iemgui_shouldvis((void *)x, &x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
 
-	/* forcing redraw of the scale handle */
-	if (x->x_gui.x_fsf.x_selected) {
-		toggle_draw_select(x, x->x_gui.x_glist);
-	}
+    /* forcing redraw of the scale handle */
+    if (x->x_gui.x_fsf.x_selected)
+    {
+        toggle_draw_select(x, x->x_gui.x_glist);
+    }
 
-	//ico@bukvic.net 100518 update scrollbars when object potentially exceeds window size
+    //ico@bukvic.net 100518 update scrollbars when
+    //object potentially exceeds window size
     t_canvas *canvas=(t_canvas *)glist_getcanvas(x->x_gui.x_glist);
-	sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (long unsigned int)canvas);
+    sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (long unsigned int)canvas);
 }
 
-static void toggle_click(t_toggle *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
+static void toggle_click(t_toggle *x, t_floatarg xpos, t_floatarg ypos,
+    t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
 {toggle_bang(x);}
 
-static int toggle_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
+static int toggle_newclick(t_gobj *z, struct _glist *glist,
+    int xpix, int ypix, int shift, int alt, int dbl, int doit)
 {
     if(doit)
-        toggle_click((t_toggle *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt);
+        toggle_click((t_toggle *)z, (t_floatarg)xpix, (t_floatarg)ypix,
+            (t_floatarg)shift, 0, (t_floatarg)alt);
     return (1);
 }
 
 static void toggle_set(t_toggle *x, t_floatarg f)
 {
-	if (x->x_on != f) x->x_gui.x_changed = 1;
+    if (x->x_on != f) x->x_gui.x_changed = 1;
     x->x_on = f;
     if(f != 0.0)
         x->x_nonzero = f;
@@ -750,10 +847,15 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
         x->x_gui.x_fsf.x_snd_able = 0;
     if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
         x->x_gui.x_fsf.x_rcv_able = 0;
-    if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
-    else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
-    else { x->x_gui.x_fsf.x_font_style = 0;
-        strcpy(x->x_gui.x_font, sys_font); }
+    if(x->x_gui.x_fsf.x_font_style == 1)
+        strcpy(x->x_gui.x_font, "helvetica");
+    else
+        if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+    else
+    {
+        x->x_gui.x_fsf.x_font_style = 0;
+        strcpy(x->x_gui.x_font, sys_font);
+    }
     x->x_nonzero = (nonzero!=0.0)?nonzero:1.0;
     if(x->x_gui.x_isa.x_loadinit)
         x->x_on = (on!=0.0)?nonzero:0.0;
@@ -773,7 +875,7 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
     iemgui_verify_snd_ne_rcv(&x->x_gui);
     outlet_new(&x->x_gui.x_obj, &s_float);
 
-	/* scale handle init */
+    /* scale handle init */
     t_scalehandle *sh;
     char buf[64];
     x->x_gui.x_handle = pd_new(scalehandle_class);
@@ -783,29 +885,29 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
     pd_bind(x->x_gui.x_handle, sh->h_bindsym = gensym(buf));
     sprintf(sh->h_outlinetag, "h%lx", (t_int)sh);
     sh->h_dragon = 0;
-	sh->h_scale = 1;
-	x->x_gui.scale_offset_x = 0;
-	x->x_gui.scale_offset_y = 0;
-	x->x_gui.scale_vis = 0;
-
-	/* label handle init */
-	t_scalehandle *lh;
-	char lhbuf[64];
-	x->x_gui.x_lhandle = pd_new(scalehandle_class);
-	lh = (t_scalehandle *)x->x_gui.x_lhandle;
-	lh->h_master = (t_gobj*)x;
-	sprintf(lhbuf, "_h%lx", (t_int)lh);
-	pd_bind(x->x_gui.x_lhandle, lh->h_bindsym = gensym(lhbuf));
-	sprintf(lh->h_outlinetag, "h%lx", (t_int)lh);
-	lh->h_dragon = 0;
-	lh->h_scale = 0;
-	x->x_gui.label_offset_x = 0;
-	x->x_gui.label_offset_y = 0;
-	x->x_gui.label_vis = 0;
-
-	x->x_gui.x_obj.te_iemgui = 1;
-
-	x->x_gui.x_changed = 1;
+    sh->h_scale = 1;
+    x->x_gui.scale_offset_x = 0;
+    x->x_gui.scale_offset_y = 0;
+    x->x_gui.scale_vis = 0;
+
+    /* label handle init */
+    t_scalehandle *lh;
+    char lhbuf[64];
+    x->x_gui.x_lhandle = pd_new(scalehandle_class);
+    lh = (t_scalehandle *)x->x_gui.x_lhandle;
+    lh->h_master = (t_gobj*)x;
+    sprintf(lhbuf, "_h%lx", (t_int)lh);
+    pd_bind(x->x_gui.x_lhandle, lh->h_bindsym = gensym(lhbuf));
+    sprintf(lh->h_outlinetag, "h%lx", (t_int)lh);
+    lh->h_dragon = 0;
+    lh->h_scale = 0;
+    x->x_gui.label_offset_x = 0;
+    x->x_gui.label_offset_y = 0;
+    x->x_gui.label_vis = 0;
+
+    x->x_gui.x_obj.te_iemgui = 1;
+
+    x->x_gui.x_changed = 1;
 
     return (x);
 }
@@ -816,19 +918,21 @@ static void toggle_ff(t_toggle *x)
         pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
     gfxstub_deleteforkey(x);
 
-	/* scale handle deconstructor */
+    /* scale handle deconstructor */
     if (x->x_gui.x_handle)
     {
-		pd_unbind(x->x_gui.x_handle, ((t_scalehandle *)x->x_gui.x_handle)->h_bindsym);
-		pd_free(x->x_gui.x_handle);
+        pd_unbind(x->x_gui.x_handle,
+            ((t_scalehandle *)x->x_gui.x_handle)->h_bindsym);
+        pd_free(x->x_gui.x_handle);
     }
 
-	/* label handle deconstructor */
-	if (x->x_gui.x_lhandle)
-	{
-		pd_unbind(x->x_gui.x_lhandle, ((t_scalehandle *)x->x_gui.x_lhandle)->h_bindsym);
-		pd_free(x->x_gui.x_lhandle);
-	}
+    /* label handle deconstructor */
+    if (x->x_gui.x_lhandle)
+    {
+        pd_unbind(x->x_gui.x_lhandle,
+            ((t_scalehandle *)x->x_gui.x_lhandle)->h_bindsym);
+        pd_free(x->x_gui.x_lhandle);
+    }
 }
 
 void g_toggle_setup(void)
@@ -842,26 +946,39 @@ void g_toggle_setup(void)
                     A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
     class_addmethod(toggle_class, (t_method)toggle_dialog, gensym("dialog"),
                     A_GIMME, 0);
-    class_addmethod(toggle_class, (t_method)toggle_loadbang, gensym("loadbang"), 0);
-    class_addmethod(toggle_class, (t_method)toggle_set, gensym("set"), A_FLOAT, 0);
-    class_addmethod(toggle_class, (t_method)toggle_size, gensym("size"), A_GIMME, 0);
-    class_addmethod(toggle_class, (t_method)toggle_delta, gensym("delta"), A_GIMME, 0);
-    class_addmethod(toggle_class, (t_method)toggle_pos, gensym("pos"), A_GIMME, 0);
-    class_addmethod(toggle_class, (t_method)toggle_color, gensym("color"), A_GIMME, 0);
-    class_addmethod(toggle_class, (t_method)toggle_send, gensym("send"), A_DEFSYM, 0);
-    class_addmethod(toggle_class, (t_method)toggle_receive, gensym("receive"), A_DEFSYM, 0);
-    class_addmethod(toggle_class, (t_method)toggle_label, gensym("label"), A_DEFSYM, 0);
-    class_addmethod(toggle_class, (t_method)toggle_label_pos, gensym("label_pos"), A_GIMME, 0);
-    class_addmethod(toggle_class, (t_method)toggle_label_font, gensym("label_font"), A_GIMME, 0);
-    class_addmethod(toggle_class, (t_method)toggle_init, gensym("init"), A_FLOAT, 0);
-    class_addmethod(toggle_class, (t_method)toggle_nonzero, gensym("nonzero"), A_FLOAT, 0);
+    class_addmethod(toggle_class, (t_method)toggle_loadbang, gensym("loadbang"),
+        0);
+    class_addmethod(toggle_class, (t_method)toggle_set, gensym("set"),
+        A_FLOAT, 0);
+    class_addmethod(toggle_class, (t_method)toggle_size, gensym("size"),
+        A_GIMME, 0);
+    class_addmethod(toggle_class, (t_method)toggle_delta, gensym("delta"),
+        A_GIMME, 0);
+    class_addmethod(toggle_class, (t_method)toggle_pos, gensym("pos"),
+        A_GIMME, 0);
+    class_addmethod(toggle_class, (t_method)toggle_color, gensym("color"),
+        A_GIMME, 0);
+    class_addmethod(toggle_class, (t_method)toggle_send, gensym("send"),
+        A_DEFSYM, 0);
+    class_addmethod(toggle_class, (t_method)toggle_receive, gensym("receive"),
+        A_DEFSYM, 0);
+    class_addmethod(toggle_class, (t_method)toggle_label, gensym("label"),
+        A_DEFSYM, 0);
+    class_addmethod(toggle_class, (t_method)toggle_label_pos,
+        gensym("label_pos"), A_GIMME, 0);
+    class_addmethod(toggle_class, (t_method)toggle_label_font,
+        gensym("label_font"), A_GIMME, 0);
+    class_addmethod(toggle_class, (t_method)toggle_init, gensym("init"),
+        A_FLOAT, 0);
+    class_addmethod(toggle_class, (t_method)toggle_nonzero, gensym("nonzero"),
+        A_FLOAT, 0);
  
     scalehandle_class = class_new(gensym("_scalehandle"), 0, 0,
-				  sizeof(t_scalehandle), CLASS_PD, 0);
+                  sizeof(t_scalehandle), CLASS_PD, 0);
     class_addmethod(scalehandle_class, (t_method)toggle__clickhook,
-		    gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
+            gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
     class_addmethod(scalehandle_class, (t_method)toggle__motionhook,
-		    gensym("_motion"), A_FLOAT, A_FLOAT, 0);
+            gensym("_motion"), A_FLOAT, A_FLOAT, 0);
 
     toggle_widgetbehavior.w_getrectfn = toggle_getrect;
     toggle_widgetbehavior.w_displacefn = iemgui_displace;
@@ -870,7 +987,7 @@ void g_toggle_setup(void)
     toggle_widgetbehavior.w_deletefn = iemgui_delete;
     toggle_widgetbehavior.w_visfn = iemgui_vis;
     toggle_widgetbehavior.w_clickfn = toggle_newclick;
-	toggle_widgetbehavior.w_displacefnwtag = iemgui_displace_withtag;
+    toggle_widgetbehavior.w_displacefnwtag = iemgui_displace_withtag;
     class_setwidget(toggle_class, &toggle_widgetbehavior);
     class_sethelpsymbol(toggle_class, gensym("toggle"));
     class_setsavefn(toggle_class, toggle_save);