Commit 0d960f30 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

clean up text_drawborder and add some demo CSS

parent 628ce64b
...@@ -381,6 +381,14 @@ text { ...@@ -381,6 +381,14 @@ text {
stroke: #ccc; stroke: #ccc;
} }
.comment .border {
fill: none;
}
#patchsvg.editmode .comment .border {
stroke: #ccc;
}
/* A little hack for special case of [cnv]. /* A little hack for special case of [cnv].
All other iemguis have a black border, but All other iemguis have a black border, but
[cnv] sets its selection rectangle to the [cnv] sets its selection rectangle to the
......
...@@ -2638,25 +2638,7 @@ void text_drawborder(t_text *x, t_glist *glist, ...@@ -2638,25 +2638,7 @@ void text_drawborder(t_text *x, t_glist *glist,
if (x->te_type == T_OBJECT) if (x->te_type == T_OBJECT)
{ {
char *pattern; char *outline; char *fill; broken = (pd_class(&x->te_pd) == text_class) ? 1 : 0;
/* 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;
}
if (firsttime) if (firsttime)
{ {
gui_vmess("gui_text_draw_border", "xssiii", gui_vmess("gui_text_draw_border", "xssiii",
...@@ -2666,22 +2648,16 @@ void text_drawborder(t_text *x, t_glist *glist, ...@@ -2666,22 +2648,16 @@ void text_drawborder(t_text *x, t_glist *glist,
broken, broken,
x2 - x1, x2 - x1,
y2 - y1); y2 - y1);
//-dash %s -> pattern disabled for tkpath
} }
else else
{ {
//fprintf(stderr, "redrawing rectangle? .x%lx.c %sR\n", //fprintf(stderr, "redrawing rectangle? .x%lx.c %sR\n",
// (t_int)glist_getcanvas(glist), tag); // (t_int)glist_getcanvas(glist), tag);
gui_vmess("gui_text_redraw_border", "xsiiii", gui_vmess("gui_text_redraw_border", "xsii",
glist_getcanvas(glist), glist_getcanvas(glist),
tag, tag,
x1, x2 - x1,
y1, y2 - 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); */
} }
} }
else if (x->te_type == T_MESSAGE) else if (x->te_type == T_MESSAGE)
...@@ -2696,12 +2672,6 @@ void text_drawborder(t_text *x, t_glist *glist, ...@@ -2696,12 +2672,6 @@ void text_drawborder(t_text *x, t_glist *glist,
} }
else 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", gui_vmess("gui_message_redraw_border", "xsii",
glist_getcanvas(glist), glist_getcanvas(glist),
tag, tag,
...@@ -2713,16 +2683,6 @@ void text_drawborder(t_text *x, t_glist *glist, ...@@ -2713,16 +2683,6 @@ void text_drawborder(t_text *x, t_glist *glist,
{ {
if (firsttime) 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", gui_vmess("gui_atom_draw_border", "xsiii",
glist_getcanvas(glist), glist_getcanvas(glist),
tag, tag,
...@@ -2734,10 +2694,6 @@ void text_drawborder(t_text *x, t_glist *glist, ...@@ -2734,10 +2694,6 @@ void text_drawborder(t_text *x, t_glist *glist,
else else
{ {
/* doesn't look like this ever gets called... */ /* 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", gui_vmess("gui_atom_redraw_border", "xsiii",
glist_getcanvas(glist), glist_getcanvas(glist),
tag, tag,
...@@ -2747,9 +2703,12 @@ void text_drawborder(t_text *x, t_glist *glist, ...@@ -2747,9 +2703,12 @@ void text_drawborder(t_text *x, t_glist *glist,
y2 - y1); y2 - y1);
} }
} }
/* for comments, just draw a dotted rectangle unlocked; when a visible /* for comments a dotted rectangle is drawn in edit mode. Currently
canvas is unlocked we have to call this anew on all comments, and when this is probably inefficient because Pd assumes it must send GUI
locked we erase them all via the annoying "commentbar" tag. IB: However 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 we do not draw these unless the comments in question are being drawn
on top level--this avoids bugggy behavior where comment rectangles are on top level--this avoids bugggy behavior where comment rectangles are
drawn inside a GOP on another toplevel glist when the GOP subpatch is 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, ...@@ -2758,23 +2717,21 @@ void text_drawborder(t_text *x, t_glist *glist,
{ {
if (firsttime) if (firsttime)
{ {
/*sys_vgui(".x%lx.c create pline\ gui_vmess("gui_text_draw_border", "xssiii",
%d %d %d %d -tags [list %sR commentbar] -stroke $pd_colors(atom_box_border)\n",*/ glist_getcanvas(glist),
/* Look like this isn't needed... */ tag,
//sys_vgui(".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d\ "none",
// -tags [list %sR commentbar %s] -stroke %s\ 0,
// -strokewidth 1 -strokedasharray {2 2} -strokelinecap butt\n", x2 - x1,
// glist_getcanvas(glist), y2 - y1);
// //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)"));
} }
else else
{ {
/* Not needed... only the parent gobj group needs to be displaced */ gui_vmess("gui_text_redraw_border", "xsii",
//sys_vgui(".x%lx.c coords %sR %d %d %d %d %d %d %d %d %d %d\n", glist_getcanvas(glist),
// glist_getcanvas(glist), tag, x1, y1, x2, y1, x2, y2, x1, y2, x1, y1); tag,
x2 - x1,
y2 - y1);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment