Commit 4e98f614 authored by Emden R. Gansner's avatar Emden R. Gansner

Add note concerning HTML strings in language description

parent 6f30222b
......@@ -122,7 +122,7 @@ digits (<TT>[0-9]</TT>), not beginning with a digit;
<LI> a numeral [<tt>-</tt>]<sup>?</sup>(<tt>.</tt>[<tt>0</tt>-<tt>9</tt>]<sup>+</sup> | [<tt>0</tt>-<tt>9</tt>]<sup>+</sup>(<tt>.</tt>[<tt>0</tt>-<tt>9</tt>]<sup>*</sup>)<sup>?</sup> );
<LI> any double-quoted string (&quot;...&quot;) possibly containing escaped
quotes (\&quot;)<SUP>1</SUP>;
<LI> an <A NAME=html>HTML string</A> (&lt;...&gt;).
<LI> an HTML string (&lt;...&gt;).
</MENU>
An ID is just a string; the lack of quote characters in the first two
forms is just for simplicity. There is no semantic difference between
......@@ -134,6 +134,9 @@ characters are allowed.
In addition, the content must be legal XML, so that the special XML
escape sequences for &quot;, &amp;, &lt;, and &gt; may be necessary
in order to embed these characters in attribute values or raw text.
As an ID, an HTML string can be any legal XML string. However, if used
as a label attribute, it is interpreted specially and must follow the syntax
for <A HREF=shapes.html#html>HTML-like labels<A>.
<P>
Both quoted strings and HTML strings are scanned as a unit, so
any embedded comments will be treated as part of the strings.
......
......@@ -13,7 +13,7 @@ digits (<TT>[0-9]</TT>), not beginning with a digit;
<LI> a numeral [<tt>-</tt>]<sup>?</sup>(<tt>.</tt>[<tt>0</tt>-<tt>9</tt>]<sup>+</sup> | [<tt>0</tt>-<tt>9</tt>]<sup>+</sup>(<tt>.</tt>[<tt>0</tt>-<tt>9</tt>]<sup>*</sup>)<sup>?</sup> );
<LI> any double-quoted string (&quot;...&quot;) possibly containing escaped
quotes (\&quot;)<SUP>1</SUP>;
<LI> an <A NAME=html>HTML string</A> (&lt;...&gt;).
<LI> an HTML string (&lt;...&gt;).
</MENU>
An ID is just a string; the lack of quote characters in the first two
forms is just for simplicity. There is no semantic difference between
......@@ -25,6 +25,9 @@ characters are allowed.
In addition, the content must be legal XML, so that the special XML
escape sequences for &quot;, &amp;, &lt;, and &gt; may be necessary
in order to embed these characters in attribute values or raw text.
As an ID, an HTML string can be any legal XML string. However, if used
as a label attribute, it is interpreted specially and must follow the syntax
for <A HREF=shapes.html#html>HTML-like labels<A>.
<P>
Both quoted strings and HTML strings are scanned as a unit, so
any embedded comments will be treated as part of the strings.
......
......@@ -462,14 +462,16 @@ fits(int x, int y, ginfo * info, PointSet * ps, point * place, int step, boxf* b
* graph is constructed where it will be.
*/
static void
placeFixed(ginfo * info, PointSet * ps, point * place, point center)
placeFixed(ginfo * info, PointSet * ps, point * place)
{
point *cells = info->cells;
int n = info->nc;
int i;
place->x = -center.x;
place->y = -center.y;
/* place->x = -center.x; */
/* place->y = -center.y; */
place->x = 0;
place->y = 0;
for (i = 0; i < n; i++) {
insertPS(ps, *cells++);
......@@ -487,22 +489,22 @@ placeFixed(ginfo * info, PointSet * ps, point * place, point center)
* First graph (i == 0) is centered on the origin if possible.
*/
static void
placeGraph(int i, ginfo * info, PointSet * ps, point * place, int step,
int margin, boxf* bbs)
placeGraph(int tryCenter, ginfo * info, PointSet * ps, point * place, int step,
int margin, boxf* bbs, int cx, int cy)
{
int x, y;
int W, H;
int bnd;
boxf bb = bbs[info->index];
if (i == 0) {
if (tryCenter) {
W = GRID(bb.UR.x - bb.LL.x + 2 * margin, step);
H = GRID(bb.UR.y - bb.LL.y + 2 * margin, step);
if (fits(-W / 2, -H / 2, info, ps, place, step, bbs))
return;
}
if (fits(0, 0, info, ps, place, step, bbs))
if (fits(cx, cy, info, ps, place, step, bbs))
return;
W = ceil(bb.UR.x - bb.LL.x);
H = ceil(bb.UR.y - bb.LL.y);
......@@ -511,19 +513,19 @@ placeGraph(int i, ginfo * info, PointSet * ps, point * place, int step,
x = 0;
y = -bnd;
for (; x < bnd; x++)
if (fits(x, y, info, ps, place, step, bbs))
if (fits(cx+x, cy+y, info, ps, place, step, bbs))
return;
for (; y < bnd; y++)
if (fits(x, y, info, ps, place, step, bbs))
if (fits(cx+x, cy+y, info, ps, place, step, bbs))
return;
for (; x > -bnd; x--)
if (fits(x, y, info, ps, place, step, bbs))
if (fits(cx+x, cy+y, info, ps, place, step, bbs))
return;
for (; y > -bnd; y--)
if (fits(x, y, info, ps, place, step, bbs))
if (fits(cx+x, cy+y, info, ps, place, step, bbs))
return;
for (; x < 0; x++)
if (fits(x, y, info, ps, place, step, bbs))
if (fits(cx+x, cy+y, info, ps, place, step, bbs))
return;
}
} else {
......@@ -531,19 +533,19 @@ placeGraph(int i, ginfo * info, PointSet * ps, point * place, int step,
y = 0;
x = -bnd;
for (; y > -bnd; y--)
if (fits(x, y, info, ps, place, step, bbs))
if (fits(cx+x, cy+y, info, ps, place, step, bbs))
return;
for (; x < bnd; x++)
if (fits(x, y, info, ps, place, step, bbs))
if (fits(cx+x, cy+y, info, ps, place, step, bbs))
return;
for (; y < bnd; y++)
if (fits(x, y, info, ps, place, step, bbs))
if (fits(cx+x, cy+y, info, ps, place, step, bbs))
return;
for (; x > -bnd; x--)
if (fits(x, y, info, ps, place, step, bbs))
if (fits(cx+x, cy+y, info, ps, place, step, bbs))
return;
for (; y > 0; y--)
if (fits(x, y, info, ps, place, step, bbs))
if (fits(cx+x, cy+y, info, ps, place, step, bbs))
return;
}
}
......@@ -762,8 +764,8 @@ polyRects(int ng, boxf* gs, pack_info * pinfo)
ps = newPS();
places = N_NEW(ng, point);
for (i = 0; i < ng; i++)
placeGraph(i, sinfo[i], ps, places + (sinfo[i]->index),
stepSize, pinfo->margin, gs);
placeGraph(i==0, sinfo[i], ps, places + (sinfo[i]->index),
stepSize, pinfo->margin, gs, 0, 0);
free(sinfo);
for (i = 0; i < ng; i++)
......@@ -864,10 +866,18 @@ polyGraphs(int ng, Agraph_t ** gs, Agraph_t * root, pack_info * pinfo)
info = N_NEW(ng, ginfo);
for (i = 0; i < ng; i++) {
Agraph_t *g = gs[i];
point ctr;
info[i].index = i;
if (fixed && fixed[i]) {
ctr.x = ROUND(GD_bb(g).LL.x);
ctr.y = ROUND(GD_bb(g).LL.y);
}
else
ctr = center;
if (pinfo->mode == l_graph)
genBox(GD_bb(g), info + i, stepSize, pinfo->margin, center, agnameof(g));
else if (genPoly(root, gs[i], info + i, stepSize, pinfo, center)) {
genBox(GD_bb(g), info + i, stepSize, pinfo->margin, ctr, agnameof(g));
else if (genPoly(root, gs[i], info + i, stepSize, pinfo, ctr)) {
return 0;
}
}
......@@ -882,20 +892,20 @@ polyGraphs(int ng, Agraph_t ** gs, Agraph_t * root, pack_info * pinfo)
ps = newPS();
places = N_NEW(ng, point);
if (fixed) {
CELL(center,stepSize);
for (i = 0; i < ng; i++) {
if (fixed[i])
placeFixed(sinfo[i], ps, places + (sinfo[i]->index),
center);
if (fixed[sinfo[i]->index])
placeFixed(sinfo[i], ps, places + (sinfo[i]->index));
}
for (i = 0; i < ng; i++) {
if (!fixed[i])
placeGraph(i, sinfo[i], ps, places + (sinfo[i]->index),
stepSize, pinfo->margin, bbs);
if (!fixed[sinfo[i]->index])
placeGraph(0, sinfo[i], ps, places + (sinfo[i]->index),
stepSize, pinfo->margin, bbs, center.x, center.y);
}
} else {
for (i = 0; i < ng; i++)
placeGraph(i, sinfo[i], ps, places + (sinfo[i]->index),
stepSize, pinfo->margin, bbs);
placeGraph(i==0, sinfo[i], ps, places + (sinfo[i]->index),
stepSize, pinfo->margin, bbs, 0, 0);
}
free(sinfo);
......
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