diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index c54c10fbbc664a02cde7486bef903f9e623cdd82..c64b38926b7e0d980f590337f40c2a837c842b8e 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -3692,6 +3692,7 @@ function gui_scope_draw_bg(cid, tag, fg_color, bg_color, w, h, grid_width, dx, d d: path_string, fill: "none", stroke: "black", + class: "grid", "stroke-width": grid_width, }); // We go ahead and create a path to be used in the foreground. We'll @@ -3730,13 +3731,13 @@ function gui_scope_configure_fg_mono(cid, tag, data_array) { scope_configure_fg(cid, tag, ".fgmono", data_array); } -function gui_scope_configure_bg_color(cid, tag, color) { +function scope_configure_bg_color(cid, tag, color) { var g = get_gobj(cid, tag), elem = g.querySelector(".bg"); configure_item(elem, { fill: color }); } -function gui_scope_configure_fg_color(cid, tag, color) { +function scope_configure_fg_color(cid, tag, color) { var g = get_gobj(cid, tag), xy = g.querySelector(".fgxy"), mono = g.querySelector(".fgmono"); @@ -3744,6 +3745,22 @@ function gui_scope_configure_fg_color(cid, tag, color) { configure_item(mono, { stroke: color }); } +function scope_configure_grid_color(cid, tag, color) { + var g = get_gobj(cid, tag), + grid = g.querySelector(".grid"); + configure_item(grid, { stroke: color }); +} + +function gui_scope_configure_color(cid, tag, layer, color) { + if (layer === "fg") { + scope_configure_fg_color(cid, tag, color); + } else if (layer === "bg") { + scope_configure_bg_color(cid, tag, color); + } else if (layer === "grid") { + scope_configure_grid_color(cid, tag, color); + } +} + function gui_scope_clear_fg(cid, tag) { scope_configure_fg(cid, tag, ".fgxy", []); scope_configure_fg(cid, tag, ".fgmono", []); diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 3fdf9473bd2e780e284cd2b546ecf450bcc238a9..6986a69524fb81d04a7783e07e83bda2de4a2380 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -3307,7 +3307,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, int noutlet; int ninlet; /* resize? only for "true" text boxes, canvases, iemguis, - and -- using an awful hack-- for the Scope~ and grid + and -- using an awful hack-- for the scope~ and grid objects by checking for the class name below. One exception-- my_canvas. It has a weirdo interface @@ -3320,7 +3320,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, */ if (ob && (ob->te_iemgui && pd_class((t_pd *)ob) != my_canvas_class - || pd_class(&ob->te_pd)->c_name == gensym("Scope~") + || pd_class(&ob->te_pd)->c_name == gensym("scope~") || pd_class(&ob->te_pd)->c_name == gensym("grid")) && xpos >= x2-4 && ypos > y2-6) { @@ -3339,7 +3339,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, } else { - pd_vmess((t_pd *)ob, gensym("_click_for_resizing"), + pd_vmess((t_pd *)ob, gensym("_click"), "fff", (t_float)1, (t_float)xpos, (t_float)ypos); } } @@ -5277,10 +5277,10 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos, pd_vmess(sh, gensym("_motion"), "ff", (t_float)xpos, (t_float)ypos); //pd_vmess(sh, gensym("_click"), "fff", 0, xpos, ypos); } - else if (ob && (pd_class(&ob->te_pd)->c_name == gensym("Scope~") + else if (ob && (pd_class(&ob->te_pd)->c_name == gensym("scope~") || pd_class(&ob->te_pd)->c_name == gensym("grid"))) { - pd_vmess((t_pd *)ob, gensym("_motion_for_resizing"), + pd_vmess((t_pd *)ob, gensym("_motion"), "ff", (t_float)xpos, (t_float)ypos); } else post("not resizable");