diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index d4a9e4852a8c670823edf7649cbfa43e0e1f4681..64050bc4fb3622cc3b6a494a424456dc102f4ff4 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -2428,52 +2428,49 @@ function gui_iemgui_label_show_drag_handle(cid, tag, state, x, y) { } } -function gui_create_mycanvas(cid,tag,color,x1,y1,x2_vis,y2_vis,x2,y2) { +function gui_create_mycanvas(c,id,x_color,x1,y1,x2_vis,y2_vis,x2,y2) { var rect_vis, rect, g; - rect_vis = create_item(cid,"rect", { + rect_vis = create_item(c, "rect", { width: x2_vis - x1, height: y2_vis - y1, - fill: color, - stroke: color, - id: tag + "rect" + fill: x2h(x_color), + stroke: x2h(x_color), + id: id + "rect" } ); // we use a drag_handle-- unlike a 'border' it takes // the same color as the visible rectangle when deselected - rect = create_item(cid,"rect", { + rect = create_item(c, "rect", { width: x2 - x1, height: y2 - y1, fill: "none", - stroke: color, - id: tag + "drag_handle", + stroke: x2h(x_color), + id: id + "drag_handle", "class": "border mycanvas_border" } ); - g = get_gobj(cid,tag); + g = get_gobj(c, id); g.appendChild(rect_vis); g.appendChild(rect); } -function gui_update_mycanvas(cid, tag, color, selected) { - var r = get_item(cid, tag + "rect"), - h = get_item(cid, tag + "drag_handle"); - configure_item(r, { fill: color, stroke: color }); +function gui_update_mycanvas(c, id, x_color, selected) { + var r = get_item(c, id + "rect"), + h = get_item(c, id + "drag_handle"); + configure_item(r, { + fill: x2h(x_color), + stroke: x2h(x_color) + }); } -function gui_mycanvas_coords(cid, tag, vis_width, vis_height, select_width, select_height) { - var r = get_item(cid, tag + "rect"), - h = get_item(cid, tag + "drag_handle"); +function gui_mycanvas_coords(c, id, vis_width, vis_height, select_width, select_height) { + var r = get_item(c, id + "rect"), + h = get_item(c, id + "drag_handle"); configure_item(r, { width: vis_width, height: vis_height }); configure_item(h, { width: select_width, height: select_height }); } -// Not needed anymore -function gui_mycanvas_select_color(cid,tag,color) { - //var item = get_item(cid,tag + "drag_handle"); - //configure_item(item, {stroke: color}); -} - function gui_create_scalar(cid, tag, isselected, t1, t2, t3, t4, t5, t6, is_toplevel) { // we should probably use create_gobj here, but we"re doing some initial diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c index 291436b05b69d7762000433e5d50cdfda55a5e58..90dbbcf6fd8e963d14b73ad14c69510e4bd75abd 100644 --- a/pd/src/g_mycanvas.c +++ b/pd/src/g_mycanvas.c @@ -25,12 +25,10 @@ void my_canvas_draw_new(t_my_canvas *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 colorbuf[MAXPDSTRING]; - sprintf(colorbuf, "#%6.6x", x->x_gui.x_bcol); gui_vmess("gui_text_create_gobj", "xxsiii", canvas, x, "iemgui", x1, y1, glist_istoplevel(canvas)); - gui_vmess("gui_create_mycanvas", "xxsiiiiii", canvas, - x, colorbuf, x1, y1, x1+x->x_vis_w, y1+x->x_vis_h, + gui_vmess("gui_create_mycanvas", "xxxiiiiii", canvas, + x, x->x_gui.x_bcol, x1, y1, x1+x->x_vis_w, y1+x->x_vis_h, x1+x->x_gui.x_w, y1+x->x_gui.x_h); } @@ -50,21 +48,14 @@ void my_canvas_draw_config(t_my_canvas* x, t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); int isselected; - char bcol[8]; sprintf(bcol, "#%6.6x", x->x_gui.x_bcol); isselected = x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas; - gui_vmess("gui_update_mycanvas", "xxsi", - canvas, x, bcol, isselected); + gui_vmess("gui_update_mycanvas", "xxxi", + canvas, x, x->x_gui.x_bcol, isselected); } void my_canvas_draw_select(t_my_canvas* x, t_glist* glist) { - t_canvas *canvas=glist_getcanvas(glist); - if (x->x_gui.x_glist != glist_getcanvas(glist)) return; - char bcol[8]; sprintf(bcol, "#%6.6x", x->x_gui.x_bcol); - gui_vmess("gui_mycanvas_select_color", "xxs", - canvas, x, - x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas ? - "blue" : bcol); + /* No longer needed */ } static void my_canvas__clickhook(t_scalehandle *sh, int newstate)