From 8489191953b750a9dd57dd4e2ca33c61e415a5d8 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Sun, 20 Nov 2016 19:39:53 -0500
Subject: [PATCH] stop using "x" for sending iemgui colors-- while it has a
 precision formatter, it doesn't have a maximum size formatter (and it can't
 because 64-bit archs need the larger values)

---
 pd/nw/pdgui.js      | 106 +++++++++++++++++++++-----------------------
 pd/src/g_all_guis.c |   5 ++-
 pd/src/g_bang.c     |  12 +++--
 pd/src/g_mycanvas.c |  12 +++--
 pd/src/g_numbox.c   |  22 +++++----
 pd/src/g_radio.c    |  12 +++--
 pd/src/g_slider.c   |  16 ++++---
 pd/src/g_toggle.c   |  12 +++--
 pd/src/g_vumeter.c  |  53 +++++++++++++---------
 9 files changed, 141 insertions(+), 109 deletions(-)

diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index d82c56cfc..ca3e272e7 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -2277,28 +2277,22 @@ function gui_bng_new(cid, tag, cx, cy, radius) {
     g.appendChild(circle);
 }
 
-// change "x123456" to "#123456". Used as a convenience function for
-// iemgui colors.
-function x2h(x_val) {
-    return "#" + x_val.slice(1);
-}
-
-function gui_bng_button_color(cid, tag, x_color) {
+function gui_bng_button_color(cid, tag, color) {
     var button = get_item(cid, tag + "button");
-    configure_item(button, { fill: x2h(x_color) });
+    configure_item(button, { fill: color });
 }
 
-function gui_bng_configure(cid, tag, x_color, cx, cy, r) {
+function gui_bng_configure(cid, tag, color, cx, cy, r) {
     var b = get_item(cid, tag + "button");
     configure_item(b, {
         cx: cx,
         cy: cy,
         r: r,
-        fill: x2h(x_color)
+        fill: color
     });
 }
 
-function gui_toggle_new(cid, tag, x_color, width, state, p1,p2,p3,p4,p5,p6,p7,p8,basex,basey) {
+function gui_toggle_new(cid, tag, color, width, state, p1,p2,p3,p4,p5,p6,p7,p8,basex,basey) {
     var g = get_gobj(cid, tag),
         points_array,
         cross1, cross2;
@@ -2307,7 +2301,7 @@ function gui_toggle_new(cid, tag, x_color, width, state, p1,p2,p3,p4,p5,p6,p7,p8
     ];
     cross1 = create_item(cid, "polyline", {
         points: points_array.join(" "),
-        stroke: x2h(x_color),
+        stroke: color,
         fill: "none",
         id: tag + "cross1",
         display: state ? "inline" : "none",
@@ -2318,7 +2312,7 @@ function gui_toggle_new(cid, tag, x_color, width, state, p1,p2,p3,p4,p5,p6,p7,p8
     ];
     cross2 = create_item(cid, "polyline", {
         points: points_array.join(" "),
-        stroke: x2h(x_color),
+        stroke: color,
         fill: "none",
         id: tag + "cross2",
         display: state ? "inline" : "none",
@@ -2351,7 +2345,7 @@ function gui_toggle_resize_cross(cid,tag,w,p1,p2,p3,p4,p5,p6,p7,p8,basex,basey)
     });
 }
 
-function gui_toggle_update(cid, tag, state, x_color) {
+function gui_toggle_update(cid, tag, state, color) {
     var cross1 = get_item(cid, tag + "cross1"),
         cross2 = get_item(cid, tag + "cross2");
     // We have to check for existence here.
@@ -2363,11 +2357,11 @@ function gui_toggle_update(cid, tag, state, x_color) {
     // non-existent tags don't throw an error.
     if (cross1) {
         if (!!state) {
-            configure_item(cross1, { display: "inline", stroke: x2h(x_color) });
-            configure_item(cross2, { display: "inline", stroke: x2h(x_color) });
+            configure_item(cross1, { display: "inline", stroke: color });
+            configure_item(cross2, { display: "inline", stroke: color });
         } else {
-            configure_item(cross1, { display: "none", stroke: x2h(x_color) });
-            configure_item(cross2, { display: "none", stroke: x2h(x_color) });
+            configure_item(cross1, { display: "none", stroke: color });
+            configure_item(cross2, { display: "none", stroke: color });
         }
     }
 }
@@ -2386,7 +2380,7 @@ function numbox_data_string(w, h) {
 }
 
 // Todo: send fewer parameters from c
-function gui_numbox_new(cid, tag, x_color, x, y, w, h, is_toplevel) {
+function gui_numbox_new(cid, tag, color, x, y, w, h, is_toplevel) {
     // numbox doesn't have a standard iemgui border,
     // so we must create its gobj manually
     var g = gui_gobj_new(cid, tag, "iemgui", x, y, is_toplevel),
@@ -2395,7 +2389,7 @@ function gui_numbox_new(cid, tag, x_color, x, y, w, h, is_toplevel) {
     data = numbox_data_string(w, h);
     border = create_item(cid, "path", {
         d: data,
-        fill: x2h(x_color),
+        fill: color,
         stroke: "black",
         "stroke-width": 1,
         id: (tag + "border"),
@@ -2411,7 +2405,7 @@ function gui_numbox_coords(cid, tag, w, h) {
     });
 }
 
-function gui_numbox_draw_text(cid,tag,text,font_size,x_color,xpos,ypos,basex,basey) {
+function gui_numbox_draw_text(cid,tag,text,font_size,color,xpos,ypos,basex,basey) {
     // kludge alert -- I'm not sure why I need to add half to the ypos
     // below. But it works for most font sizes.
     var g = get_gobj(cid, tag),
@@ -2420,7 +2414,7 @@ function gui_numbox_draw_text(cid,tag,text,font_size,x_color,xpos,ypos,basex,bas
                         (xpos - basex) + "," +
                         ((ypos - basey + (ypos - basey) * 0.5)|0) + ")",
             "font-size": font_size,
-            fill: x2h(x_color),
+            fill: color,
             id: tag + "text"
         }),
         text_node = patchwin[cid].window.document.createTextNode(text);
@@ -2428,12 +2422,12 @@ function gui_numbox_draw_text(cid,tag,text,font_size,x_color,xpos,ypos,basex,bas
     g.appendChild(svg_text);
 }
 
-function gui_numbox_update(cid, tag, x_fcolor, x_bgcolor, font_name, font_size, font_weight) {
+function gui_numbox_update(cid, tag, fcolor, bgcolor, font_name, font_size, font_weight) {
     var b = get_item(cid, tag + "border"),
         text = get_item(cid, tag + "text"),
         label = get_item(cid, tag + "label");
-    configure_item(b, { fill: x2h(x_bgcolor) });
-    configure_item(text, { fill: x2h(x_fcolor), "font-size": font_size });
+    configure_item(b, { fill: bgcolor });
+    configure_item(text, { fill: fcolor, "font-size": font_size });
     // Update the label if one exists
     if (label) {
         gui_iemgui_label_font(cid, tag, font_name, font_weight, font_size);
@@ -2447,7 +2441,7 @@ function gui_numbox_update_text_position(cid, tag, x, y) {
     });
 }
 
-function gui_slider_new(cid, tag, x_color, p1, p2, p3, p4, basex, basey) {
+function gui_slider_new(cid, tag, color, p1, p2, p3, p4, basex, basey) {
     var g = get_gobj(cid, tag),
         indicator;
     indicator = create_item(cid, "line", {
@@ -2455,7 +2449,7 @@ function gui_slider_new(cid, tag, x_color, p1, p2, p3, p4, basex, basey) {
         y1: p2 - basey,
         x2: p3 - basex,
         y2: p4 - basey,
-        stroke: x2h(x_color),
+        stroke: color,
         "stroke-width": 3,
         fill: "none",
         id: tag + "indicator"
@@ -2474,10 +2468,10 @@ function gui_slider_update(cid, tag, p1, p2, p3, p4, basex, basey) {
     });
 }
 
-function gui_slider_indicator_color(cid, tag, x_color) {
+function gui_slider_indicator_color(cid, tag, color) {
     var i = get_item(cid, tag + "indicator");
     configure_item(i, {
-        stroke: x2h(x_color)
+        stroke: color
     });
 }
 
@@ -2498,7 +2492,7 @@ function gui_radio_new(cid, tag, p1, p2, p3, p4, i, basex, basey) {
     g.appendChild(cell);
 }
 
-function gui_radio_create_buttons(cid,tag,x_color,p1,p2,p3,p4,basex,basey,i,state) {
+function gui_radio_create_buttons(cid,tag,color,p1,p2,p3,p4,basex,basey,i,state) {
     var g = get_gobj(cid, tag),
         b;
     b = create_item(cid, "rect", {
@@ -2506,8 +2500,8 @@ function gui_radio_create_buttons(cid,tag,x_color,p1,p2,p3,p4,basex,basey,i,stat
         y: p2 - basey,
         width: p3 - p1,
         height: p4 - p2,
-        stroke: x2h(x_color),
-        fill: x2h(x_color),
+        stroke: color,
+        fill: color,
         id: tag + "button_" + i,
         display: state ? "inline" : "none"
     });
@@ -2535,18 +2529,18 @@ function gui_radio_button_coords(cid, tag, x1, y1, xi, yi, i, s, d, orient) {
     });
 }
 
-function gui_radio_update(cid, tag, x_fgcolor, prev, next) {
+function gui_radio_update(cid, tag, fgcolor, prev, next) {
     var prev = get_item(cid, tag + "button_" + prev),
         next = get_item(cid, tag + "button_" + next);
     configure_item(prev, { display: "none" });
     configure_item(next, {
         display: "inline",
-        fill: x2h(x_fgcolor),
-        stroke: x2h(x_fgcolor)
+        fill: fgcolor,
+        stroke: fgcolor
     });
 }
 
-function gui_vumeter_draw_text(cid,tag,x_color,xpos,ypos,text,index,basex,basey, font_size, font_weight) {
+function gui_vumeter_draw_text(cid,tag,color,xpos,ypos,text,index,basex,basey, font_size, font_weight) {
     var g = get_gobj(cid, tag),
         svg_text = create_item(cid, "text", {
             x: xpos - basex,
@@ -2570,12 +2564,12 @@ function gui_vumeter_draw_text(cid,tag,x_color,xpos,ypos,text,index,basex,basey,
 // c) recreate all the missing labels
 // To get on to other work we just parrot the insanity here,
 // and silently ignore calls to update non-existent text.
-function gui_vumeter_update_text(cid, tag, text, font, selected, x_color, i) {
+function gui_vumeter_update_text(cid, tag, text, font, selected, color, i) {
     var svg_text = get_item(cid, tag + "text_" + i);
     if (!selected) {
         // Hack...
         if (svg_text !== null) {
-            configure_item(svg_text, { fill: x2h(x_color) });
+            configure_item(svg_text, { fill: color });
         }
     }
 }
@@ -2590,7 +2584,7 @@ function gui_vumeter_erase_text(cid, tag, i) {
     t.parentNode.removeChild(t);
 }
 
-function gui_vumeter_create_steps(cid,tag,x_color,p1,p2,p3,p4,width,basex,basey,i) {
+function gui_vumeter_create_steps(cid,tag,color,p1,p2,p3,p4,width,basex,basey,i) {
     var g = get_gobj(cid, tag),
         l;
     l = create_item(cid, "line", {
@@ -2598,7 +2592,7 @@ function gui_vumeter_create_steps(cid,tag,x_color,p1,p2,p3,p4,width,basex,basey,
         y1: p2 - basey,
         x2: p3 - basex,
         y2: p4 - basey,
-        stroke: x2h(x_color),
+        stroke: color,
         "stroke-width": width,
         "id": tag + "led_" + i
     });
@@ -2620,7 +2614,7 @@ function gui_vumeter_update_step_coords(cid,tag,i,x1,y1,x2,y2,basex,basey) {
     });
 }
 
-function gui_vumeter_draw_rect(cid,tag,x_color,p1,p2,p3,p4,basex,basey) {
+function gui_vumeter_draw_rect(cid,tag,color,p1,p2,p3,p4,basex,basey) {
     var g = get_gobj(cid, tag),
         rect;
     rect = create_item(cid, "rect", {
@@ -2628,16 +2622,16 @@ function gui_vumeter_draw_rect(cid,tag,x_color,p1,p2,p3,p4,basex,basey) {
         y: p2 - basey,
         width: p3 - p1,
         height: p4 + 1 - p2,
-        stroke: x2h(x_color),
-        fill: x2h(x_color),
+        stroke: color,
+        fill: color,
         id: tag + "rect"
     });
     g.appendChild(rect);
 }
 
-function gui_vumeter_update_rect(cid, tag, x_color) {
+function gui_vumeter_update_rect(cid, tag, color) {
     var r = get_item(cid, tag + "rect");
-    configure_item(r, { fill: x2h(x_color), stroke: x2h(x_color) });
+    configure_item(r, { fill: color, stroke: color });
 }
 
 // Oh hack upon hack... why doesn't the iemgui base_config just take care
@@ -2684,23 +2678,23 @@ function gui_vumeter_update_rms(cid, tag, p1, p2, p3, p4, basex, basey) {
     });
 }
 
-function gui_vumeter_update_peak(cid,tag,x_color,p1,p2,p3,p4,basex,basey) {
+function gui_vumeter_update_peak(cid,tag,color,p1,p2,p3,p4,basex,basey) {
     var line = get_item(cid, tag + "peak");
     configure_item(line, {
         x1: p1 - basex,
         y1: p2 - basey,
         x2: p3 - basex,
         y2: p4 - basey,
-        stroke: x2h(x_color)
+        stroke: color
     });
 }
 
-function gui_iemgui_base_color(cid, tag, x_color) {
+function gui_iemgui_base_color(cid, tag, color) {
     var g = get_gobj(cid, tag),
         b;
     if (g) {
         b = g.querySelector(".border");
-        configure_item(b, { fill: x2h(x_color) });
+        configure_item(b, { fill: color });
     }
 }
 
@@ -2867,13 +2861,13 @@ function gui_iemgui_label_show_drag_handle(cid, tag, state, x, y, cnv_resize) {
     }
 }
 
-function gui_mycanvas_new(cid,tag,x_color,x1,y1,x2_vis,y2_vis,x2,y2) {
+function gui_mycanvas_new(cid,tag,color,x1,y1,x2_vis,y2_vis,x2,y2) {
     var rect_vis, rect, g;
     rect_vis = create_item(cid, "rect", {
         width: x2_vis - x1,
         height: y2_vis - y1,
-        fill: x2h(x_color),
-        stroke: x2h(x_color),
+        fill: color,
+        stroke: color,
         id: tag + "rect"
         }
     );
@@ -2884,7 +2878,7 @@ function gui_mycanvas_new(cid,tag,x_color,x1,y1,x2_vis,y2_vis,x2,y2) {
         width: x2 - x1,
         height: y2 - y1,
         fill: "none",
-        stroke: x2h(x_color),
+        stroke: color,
         id: tag + "drag_handle",
         "class": "border mycanvas_border"
         }
@@ -2894,12 +2888,12 @@ function gui_mycanvas_new(cid,tag,x_color,x1,y1,x2_vis,y2_vis,x2,y2) {
     g.appendChild(rect);
 }
 
-function gui_mycanvas_update(cid, tag, x_color, selected) {
+function gui_mycanvas_update(cid, tag, color, selected) {
     var r = get_item(cid, tag + "rect"),
         h = get_item(cid, tag + "drag_handle");
     configure_item(r, {
-        fill: x2h(x_color),
-        stroke: x2h(x_color)
+        fill: color,
+        stroke: color
     });
 }
 
diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c
index f9c11fbfd..c264c3780 100644
--- a/pd/src/g_all_guis.c
+++ b/pd/src/g_all_guis.c
@@ -1190,8 +1190,9 @@ void iemgui_base_draw_new(t_iemgui *x) {
         colorbuf,
         0,
         x1, y1, x2, y2);
-    gui_vmess("gui_iemgui_base_color", "xxx",
-        canvas, x, x->x_bcol);
+    sprintf(colorbuf, "#%6.6x", x->x_bcol);
+    gui_vmess("gui_iemgui_base_color", "xxs",
+        canvas, x, colorbuf);
 }
 
 void iemgui_base_draw_move(t_iemgui *x) {
diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c
index 15306bd7d..60b4b0ff9 100644
--- a/pd/src/g_bang.c
+++ b/pd/src/g_bang.c
@@ -25,12 +25,14 @@ static t_class *bng_class;
 void bng_draw_update(t_gobj *xgobj, t_glist *glist)
 {
     t_bng *x = (t_bng *)xgobj;
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_flashed ? x->x_gui.x_fcol : x->x_gui.x_bcol);
     if (x->x_gui.x_changed != x->x_flashed && glist_isvisible(glist))
     {
-        gui_vmess("gui_bng_button_color", "xxx",
+        gui_vmess("gui_bng_button_color", "xxs",
             glist_getcanvas(glist),
             &x->x_gui,
-            x->x_flashed ? x->x_gui.x_fcol : x->x_gui.x_bcol);
+            cbuf);
     }
     x->x_gui.x_changed = x->x_flashed;
 }
@@ -63,6 +65,8 @@ void bng_draw_new(t_bng *x, t_glist *glist)
 void bng_draw_move(t_bng *x, t_glist *glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_flashed ? x->x_gui.x_fcol : x->x_gui.x_bcol);
     if (!glist_isvisible(canvas)) return;
     int x1=text_xpix(&x->x_gui.x_obj, glist);
     int y1=text_ypix(&x->x_gui.x_obj, glist);
@@ -71,10 +75,10 @@ void bng_draw_move(t_bng *x, t_glist *glist)
     t_float cr = (x->x_gui.x_w-2)/2.0;
     t_float cx = x1+cr+1;
     t_float cy = y1+cr+1;
-    gui_vmess("gui_bng_configure", "xxxfff",
+    gui_vmess("gui_bng_configure", "xxsfff",
         canvas,
         x,
-        x->x_flashed ? x->x_gui.x_fcol : x->x_gui.x_bcol,
+        cbuf,
         cx - x1,
         cy - y1,
         cr);
diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c
index 3be396a28..e51690b31 100644
--- a/pd/src/g_mycanvas.c
+++ b/pd/src/g_mycanvas.c
@@ -24,11 +24,13 @@ void my_canvas_draw_new(t_my_canvas *x, t_glist *glist)
     t_canvas *canvas=glist_getcanvas(glist);
     int x1=text_xpix(&x->x_gui.x_obj, glist);
     int y1=text_ypix(&x->x_gui.x_obj, glist);
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_bcol);
 
     gui_vmess("gui_gobj_new", "xxsiii", canvas,
         x, "iemgui", x1, y1, glist_istoplevel(canvas));
-    gui_vmess("gui_mycanvas_new", "xxxiiiiii", canvas,
-        x, x->x_gui.x_bcol, x1, y1, x1+x->x_vis_w, y1+x->x_vis_h,
+    gui_vmess("gui_mycanvas_new", "xxsiiiiii", canvas,
+        x, cbuf, x1, y1, x1+x->x_vis_w, y1+x->x_vis_h,
         x1+x->x_gui.x_w, y1+x->x_gui.x_h);
 }
 
@@ -48,9 +50,11 @@ void my_canvas_draw_config(t_my_canvas* x, t_glist* glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
     int isselected;
+    char cbuf[8];
     isselected = x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas;
-    gui_vmess("gui_mycanvas_update", "xxxi",
-        canvas, x, x->x_gui.x_bcol, isselected);
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_bcol);
+    gui_vmess("gui_mycanvas_update", "xxsi",
+        canvas, x, cbuf, isselected);
 }
 
 void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c
index 988e55e09..890b6928a 100644
--- a/pd/src/g_numbox.c
+++ b/pd/src/g_numbox.c
@@ -158,14 +158,16 @@ static void my_numbox_draw_update(t_gobj *client, t_glist *glist)
 static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_bcol);
     int half=x->x_gui.x_h/2, d=1+x->x_gui.x_h/34;
     int x1=text_xpix(&x->x_gui.x_obj, glist), x2=x1+x->x_numwidth;
     int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h;
 
-    gui_vmess("gui_numbox_new", "xxxiiiii",
+    gui_vmess("gui_numbox_new", "xxsiiiii",
         canvas,
         x,
-        x->x_gui.x_bcol,
+        cbuf,
         x1,
         y1,
         x2 - x1,
@@ -181,12 +183,13 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist)
         //    x->x_gui.x_fcol, x, x);
     }
     my_numbox_ftoa(x);
-    gui_vmess("gui_numbox_draw_text", "xxsixiiii",
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_fcol);
+    gui_vmess("gui_numbox_draw_text", "xxsisiiii",
         canvas,
         x,
         x->x_buf,
         x->x_gui.x_fontsize,
-        x->x_gui.x_fcol,
+        cbuf,
         x1+half+2, y1+half+d, x1, y1);
 }
 
@@ -225,13 +228,16 @@ static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist)
 static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
+    char fg[8], bg[8];
+    sprintf(fg, "#%6.6x",  x->x_gui.x_fcol);
+    sprintf(bg, "#%6.6x",  x->x_gui.x_bcol);
     int issel = x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas;
-    gui_vmess("gui_numbox_update", "xxxxsii",
+    gui_vmess("gui_numbox_update", "xxsssii",
         canvas,
         x,
-        x->x_gui.x_fcol,
-        x->x_gui.x_bcol,
-        iemgui_typeface(x),
+        fg,
+        bg,
+        iemgui_typeface((t_iemgui *)x),
         x->x_gui.x_fontsize,
         sys_fontweight);
 }
diff --git a/pd/src/g_radio.c b/pd/src/g_radio.c
index cea78ac10..f85a4a83f 100644
--- a/pd/src/g_radio.c
+++ b/pd/src/g_radio.c
@@ -40,6 +40,8 @@ void radio_draw_update(t_gobj *client, t_glist *glist)
 void radio_draw_new(t_radio *x, t_glist *glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_fcol);
     int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
     int x1=text_xpix(&x->x_gui.x_obj, glist), xi=x1;
     int y1=text_ypix(&x->x_gui.x_obj, glist), yi=y1; 
@@ -54,9 +56,9 @@ void radio_draw_new(t_radio *x, t_glist *glist)
                 gui_vmess("gui_radio_new", "xxiiiiiii",
                     canvas, x, x1, yi, x1+d, yi, i, x1, y1);
             }
-            gui_vmess("gui_radio_create_buttons", "xxxiiiiiiii",
+            gui_vmess("gui_radio_create_buttons", "xxsiiiiiiii",
                 canvas, x,
-                x->x_gui.x_fcol,
+                cbuf,
                 x1+s, yi+s, x1+d-s, yi+d-s, x1, y1, i, x->x_on==i);
             yi += d;
             x->x_drawn = x->x_on;
@@ -106,6 +108,8 @@ void radio_draw_config(t_radio *x, t_glist *glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
     int n=x->x_number, i;
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_fcol);
     iemgui_base_draw_config(&x->x_gui);
     for (i=0; i<n; i++)
     {
@@ -114,8 +118,8 @@ void radio_draw_config(t_radio *x, t_glist *glist)
         //    (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol,
         //    (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol);
     }
-    gui_vmess("gui_radio_update", "xxxii",
-        canvas, x, x->x_gui.x_fcol, 0, x->x_on);
+    gui_vmess("gui_radio_update", "xxsii",
+        canvas, x, cbuf, 0, x->x_on);
 
 }
 
diff --git a/pd/src/g_slider.c b/pd/src/g_slider.c
index 896f0377d..41e015dc1 100644
--- a/pd/src/g_slider.c
+++ b/pd/src/g_slider.c
@@ -55,6 +55,8 @@ static void slider_draw_update(t_gobj *client, t_glist *glist)
 static void slider_draw_new(t_slider *x, t_glist *glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_fcol);
     int x1=text_xpix(&x->x_gui.x_obj, glist), x2=x1+x->x_gui.x_w;
     int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h;
     if (x->x_orient) y2+=5; else x2+=5;
@@ -63,13 +65,13 @@ static void slider_draw_new(t_slider *x, t_glist *glist)
     else             r = x1+3 + (x->x_val + 50)/100;
     iemgui_base_draw_new(&x->x_gui);
     if (x->x_orient) {
-        gui_vmess("gui_slider_new", "xxxiiiiii",
+        gui_vmess("gui_slider_new", "xxsiiiiii",
             canvas, x,
-            x->x_gui.x_fcol, x1+2, r, x2-2, r, x1, y1);
+            cbuf, x1+2, r, x2-2, r, x1, y1);
     } else {
-        gui_vmess("gui_slider_new", "xxxiiiiii",
+        gui_vmess("gui_slider_new", "xxsiiiiii",
             canvas, x,
-            x->x_gui.x_fcol, r, y1+2, r, y2-2, x1, y1);
+            cbuf, r, y1+2, r, y2-2, x1, y1);
     }
 }
 
@@ -101,9 +103,11 @@ static void slider_draw_move(t_slider *x, t_glist *glist)
 static void slider_draw_config(t_slider *x, t_glist *glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_fcol);
     iemgui_base_draw_config(&x->x_gui);
-    gui_vmess("gui_slider_indicator_color", "xxx",
-        canvas, x, x->x_gui.x_fcol);
+    gui_vmess("gui_slider_indicator_color", "xxs",
+        canvas, x, cbuf);
 }
 
 void slider_check_minmax(t_slider *x, double min, double max);
diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c
index f6a8d3a10..41812f2a4 100644
--- a/pd/src/g_toggle.c
+++ b/pd/src/g_toggle.c
@@ -35,6 +35,8 @@ void toggle_draw_update(t_gobj *xgobj, t_glist *glist)
 void toggle_draw_new(t_toggle *x, t_glist *glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_fcol);
     int w=(x->x_gui.x_w+29)/30;
     int x1=text_xpix(&x->x_gui.x_obj, glist);
     int y1=text_ypix(&x->x_gui.x_obj, glist);
@@ -42,8 +44,8 @@ void toggle_draw_new(t_toggle *x, t_glist *glist)
     int col = (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol;
 
     iemgui_base_draw_new(&x->x_gui);
-    gui_vmess("gui_toggle_new", "xxxiiiiiiiiiiii", canvas,
-        x, x->x_gui.x_fcol, w,
+    gui_vmess("gui_toggle_new", "xxsiiiiiiiiiiii", canvas,
+        x, cbuf, w,
         (x->x_on != 0.0),
         x1+w+1, y1+w+1, x2-w-1, y2-w-1,
         x1+w+1, y2-w-1, x2-w-1, y1+w+1, x1, y1);
@@ -69,14 +71,16 @@ void toggle_draw_move(t_toggle *x, t_glist *glist)
 void toggle_draw_config(t_toggle* x, t_glist* glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_fcol);
     iemgui_base_draw_config(&x->x_gui);
     if (glist_isvisible(glist_getcanvas(glist)))
     {
-        gui_vmess("gui_toggle_update", "xxix",
+        gui_vmess("gui_toggle_update", "xxis",
             canvas,
             x,
             x->x_on != 0.0,
-            x->x_gui.x_fcol);
+            cbuf);
     }
 }
 
diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c
index 154154d6d..4ade10401 100644
--- a/pd/src/g_vumeter.c
+++ b/pd/src/g_vumeter.c
@@ -89,22 +89,24 @@ static void vu_update_peak(t_vu *x, t_glist *glist)
     {
         int x1 = text_xpix(&x->x_gui.x_obj, glist);
         int y1 = text_ypix(&x->x_gui.x_obj, glist);
+        char cbuf[8];
 
-        if(x->x_peak)
+        if (x->x_peak)
         {
             int i = iemgui_vu_col[x->x_peak];
             int j = y1 + (x->x_led_size + 1) * (IEM_VU_STEPS + 1 - x->x_peak)
                 - (x->x_led_size + 1) / 2;
-
-            gui_vmess("gui_vumeter_update_peak", "xxxiiiiii",
-                canvas, x, iemgui_color_hex[i],
+            sprintf(cbuf, "#%06x", iemgui_color_hex[i]);
+            gui_vmess("gui_vumeter_update_peak", "xxsiiiiii",
+                canvas, x, cbuf,
                 x1 + 1, j + 2, x1 + x->x_gui.x_w + 2, j + 2, x1, y1);
         }
         else
         {
             int mid = x1 + x->x_gui.x_w / 2;
-            gui_vmess("gui_vumeter_update_peak", "xxxiiiiii",
-                canvas, x, x->x_gui.x_bcol,
+            sprintf(cbuf, "#%6.6x", x->x_gui.x_bcol);
+            gui_vmess("gui_vumeter_update_peak", "xxsiiiiii",
+                canvas, x, cbuf,
                 mid+1, y1+22, mid+1, y1+22, x1, y1);
         }
     }
@@ -134,6 +136,7 @@ static void vu_draw_new(t_vu *x, t_glist *glist)
     int quad3=x2-w4, end=x2+4;
     int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2;
     int led_col, yyy, i, k4=y1-k3;
+    char cbuf[8];
     iemgui_base_draw_new(&x->x_gui);
 
     for(i = 1; i <= IEM_VU_STEPS+1; i++)
@@ -141,10 +144,11 @@ static void vu_draw_new(t_vu *x, t_glist *glist)
         yyy = k4 + k1 * (k2-i);
         if((i&3)==1 && (x->x_scale))
         {
+            sprintf(cbuf, "#%06x", x->x_gui.x_lcol);
             // not handling font size yet
-            gui_vmess("gui_vumeter_draw_text", "xxxiisiiiis",
+            gui_vmess("gui_vumeter_draw_text", "xxsiisiiiis",
                 canvas, x,
-                x->x_gui.x_lcol, end+1, yyy+k3+2, iemgui_vu_scale_str[i/4],
+                cbuf, end+1, yyy+k3+2, iemgui_vu_scale_str[i/4],
                 i, x1, y1,
                 x->x_gui.x_fontsize,
                 sys_fontweight);
@@ -152,17 +156,19 @@ static void vu_draw_new(t_vu *x, t_glist *glist)
         led_col = iemgui_vu_col[i];
         if (i<=IEM_VU_STEPS)
         {
-            gui_vmess("gui_vumeter_create_steps", "xxxiiiiiiii",
-                canvas, x, iemgui_color_hex[led_col], quad1+1,
+            sprintf(cbuf, "#%06x", iemgui_color_hex[led_col]);
+            gui_vmess("gui_vumeter_create_steps", "xxsiiiiiiii",
+                canvas, x, cbuf, quad1+1,
                 yyy+2, quad3, yyy+2, x->x_led_size, x1, y1, i);
         }
     }
-    gui_vmess("gui_vumeter_draw_rect", "xxxiiiiii",
+    sprintf(cbuf, "#%06x", x->x_gui.x_bcol);
+    gui_vmess("gui_vumeter_draw_rect", "xxsiiiiii",
         canvas, x,
-        x->x_gui.x_bcol, quad1+1, y1+1, quad3, y1+1 + k1*IEM_VU_STEPS, x1, y1);
-    gui_vmess("gui_vumeter_draw_peak", "xxxiiiiiii",
+        cbuf, quad1+1, y1+1, quad3, y1+1 + k1*IEM_VU_STEPS, x1, y1);
+    gui_vmess("gui_vumeter_draw_peak", "xxsiiiiiii",
         canvas, x,
-        x->x_gui.x_bcol, mid+1, y1+12, mid+1, y1+12, x->x_led_size, x1, y1);
+        cbuf, mid+1, y1+12, mid+1, y1+12, x->x_led_size, x1, y1);
     x->x_updaterms = x->x_updatepeak = 1;
     sys_queuegui(x, x->x_gui.x_glist, vu_draw_update);
 }
@@ -212,6 +218,8 @@ static void vu_draw_config(t_vu* x, t_glist* glist)
 {
     int i;
     t_canvas *canvas=glist_getcanvas(glist);
+    char cbuf[8];
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_lcol);
     for(i = 1; i <= IEM_VU_STEPS+1; i++)
     {
         if (i <= IEM_VU_STEPS)
@@ -226,11 +234,12 @@ static void vu_draw_config(t_vu* x, t_glist* glist)
                 x->x_gui.x_glist == canvas && x->x_scale;
             gui_vmess("gui_vumeter_update_text", "xxssixi",
                 canvas, x, iemgui_vu_scale_str[i/4],
-                iemgui_font(&x->x_gui), isselected, x->x_gui.x_lcol, i);
+                iemgui_font(&x->x_gui), isselected, cbuf, i);
         }
     }
-    gui_vmess("gui_vumeter_update_rect", "xxx",
-        canvas, x, x->x_gui.x_bcol);
+    sprintf(cbuf, "#%6.6x", x->x_gui.x_bcol);
+    gui_vmess("gui_vumeter_update_rect", "xxs",
+        canvas, x, cbuf);
     gui_vmess("gui_vumeter_update_peak_width", "xxi",
         canvas, x, x->x_led_size);
     iemgui_base_draw_config(&x->x_gui);
@@ -421,6 +430,7 @@ void vu_check_height(t_vu *x, int h)
 static void vu_scale(t_vu *x, t_floatarg fscale)
 {
     int i, scale = (int)fscale;
+    char cbuf[8];
 
     if(scale != 0) scale = 1;
     if(x->x_scale && !scale)
@@ -455,21 +465,22 @@ static void vu_scale(t_vu *x, t_floatarg fscale)
         x->x_scale = (int)scale;
         if(glist_isvisible(x->x_gui.x_glist))
         {
+            sprintf(cbuf, "#%6.6x", x->x_gui.x_lcol);
             for(i=1; i<=IEM_VU_STEPS; i++)
             {
                 yyy = k4 + k1*(k2-i);
                 if((i&3)==1)
                 {
-                    gui_vmess("gui_vumeter_draw_text", "xxxiisiii",
-                        canvas, x, x->x_gui.x_lcol,
+                    gui_vmess("gui_vumeter_draw_text", "xxsiisiii",
+                        canvas, x, cbuf,
                         end+1, yyy+k3+2, iemgui_vu_scale_str[i/4],
                         i, end, yyy);
                 }
             }
             i = IEM_VU_STEPS + 1;
             yyy = k4 + k1*(k2-i);
-            gui_vmess("gui_vumeter_draw_text", "xxxiisiii",
-                canvas, x, x->x_gui.x_lcol,
+            gui_vmess("gui_vumeter_draw_text", "xxsiisiii",
+                canvas, x, cbuf,
                 end+1, yyy+k3+2, iemgui_vu_scale_str[i/4],
                 i, end, yyy);
         }
-- 
GitLab