diff --git a/pd/nw/css/default.css b/pd/nw/css/default.css index 4df1ccc685a781c50eff018628c1243e7bfdb85e..63782f35db643d59c7fb8a9adf7df4d682a5db13 100644 --- a/pd/nw/css/default.css +++ b/pd/nw/css/default.css @@ -381,6 +381,14 @@ text { stroke: #ccc; } +.comment .border { + fill: none; +} + +#patchsvg.editmode .comment .border { + stroke: #ccc; +} + /* A little hack for special case of [cnv]. All other iemguis have a black border, but [cnv] sets its selection rectangle to the diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index c5ea1081324aeea6bfa53353760fd1858ad47248..6d23d61f865502b20fb9c4210a85be9b209eebf9 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -2410,7 +2410,7 @@ function gui_text_set (cid, tag, text) { }); } -function gui_text_redraw_border(cid, tag, x1, y1, x2, y2) { +function gui_text_redraw_border(cid, tag, width, height) { // Hm, need to figure out how to refactor to get rid of // configure_item call... gui(cid).get_gobj(tag, function(e) { @@ -2418,8 +2418,8 @@ function gui_text_redraw_border(cid, tag, x1, y1, x2, y2) { i; for (i = 0; i < b.length; b++) { configure_item(b[i], { - width: x2 - x1, - height: y2 - y1 + width: width, + height: height }); } }); diff --git a/pd/src/g_text.c b/pd/src/g_text.c index f7da7c030f3d77b06f26a07e45083cfa46d2e409..f5a42a6d1c59971fe58bb95657a2204d32411e6a 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -2638,25 +2638,7 @@ void text_drawborder(t_text *x, t_glist *glist, if (x->te_type == T_OBJECT) { - char *pattern; char *outline; char *fill; - /* tag to identify broken boxes from tcl/tk */ - char *box_tag; - if (pd_class(&x->te_pd) == text_class) - { - pattern = "-"; - outline = "$pd_colors(dash_outline) -strokewidth 2 -strokelinecap projecting -strokedasharray {2 3}"; //-strokedasharray {4 1} - fill = invalid_fill; - box_tag = "broken box"; - broken = 1; - } - else - { - pattern = "\"\""; - outline = "$pd_colors(box_border)"; - fill = "$pd_colors(box)"; - box_tag = "box"; - broken = 0; - } + broken = (pd_class(&x->te_pd) == text_class) ? 1 : 0; if (firsttime) { gui_vmess("gui_text_draw_border", "xssiii", @@ -2666,22 +2648,16 @@ void text_drawborder(t_text *x, t_glist *glist, broken, x2 - x1, y2 - y1); - //-dash %s -> pattern disabled for tkpath } else { //fprintf(stderr, "redrawing rectangle? .x%lx.c %sR\n", // (t_int)glist_getcanvas(glist), tag); - gui_vmess("gui_text_redraw_border", "xsiiii", + gui_vmess("gui_text_redraw_border", "xsii", glist_getcanvas(glist), tag, - x1, - y1, - x2, - y2); - /* this seems to be totally extraneous hans@at.or.at - sys_vgui(".x%lx.c itemconfigure %sR -dash %s -outline %s\n", - glist_getcanvas(glist), tag, pattern, outline); */ + x2 - x1, + y2 - y1); } } else if (x->te_type == T_MESSAGE) @@ -2696,12 +2672,6 @@ void text_drawborder(t_text *x, t_glist *glist, } else { - //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); - /* These coords can be greatly simplified, as above... */ gui_vmess("gui_message_redraw_border", "xsii", glist_getcanvas(glist), tag, @@ -2713,16 +2683,6 @@ void text_drawborder(t_text *x, t_glist *glist, { if (firsttime) { - //sys_vgui(".x%lx.c create ppolygon " - // "%d %d %d %d %d %d %d %d %d %d %d %d " - // "-stroke %s " - // "-fill $pd_colors(atom_box) " - // "-tags {%sR %lx text atom box %s}\n", - // glist_getcanvas(glist), - // x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, x1, y1, - // (selected ? "$pd_colors(selection)" : "$pd_colors(atom_box_border)"), - // tag, tag, (selected ? "selected" : "")); - /* These coords can be greatly simplified... */ gui_vmess("gui_atom_draw_border", "xsiii", glist_getcanvas(glist), tag, @@ -2734,10 +2694,6 @@ void text_drawborder(t_text *x, t_glist *glist, else { /* doesn't look like this ever gets called... */ - //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); gui_vmess("gui_atom_redraw_border", "xsiii", glist_getcanvas(glist), tag, @@ -2747,9 +2703,12 @@ void text_drawborder(t_text *x, t_glist *glist, y2 - y1); } } - /* for comments, just draw a dotted rectangle unlocked; when a visible - canvas is unlocked we have to call this anew on all comments, and when - locked we erase them all via the annoying "commentbar" tag. IB: However + /* for comments a dotted rectangle is drawn in edit mode. Currently + this is probably inefficient because Pd assumes it must send GUI + updates for all comments when edit mode is toggled (due to the + "commentbar" sizing line in Pd Vanilla). However in Purr Data, we + let CSS do all that and thus don't require that inefficiency. + Also, we do not draw these unless the comments in question are being drawn on top level--this avoids bugggy behavior where comment rectangles are drawn inside a GOP on another toplevel glist when the GOP subpatch is @@ -2758,23 +2717,21 @@ void text_drawborder(t_text *x, t_glist *glist, { if (firsttime) { - /*sys_vgui(".x%lx.c create pline\ - %d %d %d %d -tags [list %sR commentbar] -stroke $pd_colors(atom_box_border)\n",*/ - /* Look like this isn't needed... */ - //sys_vgui(".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d\ - // -tags [list %sR commentbar %s] -stroke %s\ - // -strokewidth 1 -strokedasharray {2 2} -strokelinecap butt\n", - // glist_getcanvas(glist), - // //x2, y1, x2, y2, tag); - // x1, y1, x2, y1, x2, y2, x1, y2, x1, y1, tag, - // (selected ? "selected" : ""), - // (selected ? "$pd_colors(selection)" : "$pd_colors(box_border)")); + gui_vmess("gui_text_draw_border", "xssiii", + glist_getcanvas(glist), + tag, + "none", + 0, + x2 - x1, + y2 - y1); } else { - /* Not needed... only the parent gobj group needs to be displaced */ - //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); + gui_vmess("gui_text_redraw_border", "xsii", + glist_getcanvas(glist), + tag, + x2 - x1, + y2 - y1); } }