54#define DEFAULT_BORDER 1
55#define DEFAULT_CELLPADDING 2
56#define DEFAULT_CELLSPACING 2
69static void printCell(
htmlcell_t * cp,
int ind);
113 if (savp->
size >= 0.0)
121 double center_x, left_x, right_x;
128 left_x = center_x - halfwidth_x;
129 right_x = center_x + halfwidth_x;
134 p_.
y = p.
y + (b.
UR.
y - b.
LL.
y) / 2.0;
137 for (
size_t i = 0; i < nspans; i++) {
139 switch (spans[i].just) {
144 p.
x = right_x - spans[i].
size;
148 p.
x = center_x - spans[i].
size / 2.0;
154 for (
size_t j = 0; j < spans[i].
nitems; j++) {
235 double delta = (double)border / 2.0;
260 unsigned short sides;
264 sptr[0] = sptr[1] =
NULL;
425 if(obj->fld != save->fld) {free(obj->fld); obj->fld = save->fld;}
494 doSide(job, rule_pt, 0, rule_length);
505 else if (nextc && nextc->
row != cp->
row) {
516 if (nextc && nextc->
row != cp->
row) {
522 doSide(job, rule_pt, rule_length, 0);
579 while ((cp = *cells++)) {
823 for (
size_t i = 0; i < t->
nspans; i++) {
825 for (
size_t j = 0; j < tl->
nitems; j++) {
919 while ((cp = *cells++)) {
956 double mxfsize = 0.0;
957 double curbline = 0.0;
962 double maxoffset, mxysize = 0.0;
964 double prev_fsize = -1;
965 char* prev_fname =
NULL;
967 for (
size_t i = 0; i < ftxt->
nspans; i++) {
991 prev_fsize = tf.
size;
992 else if (tf.
size != prev_fsize) {
996 if (prev_fname ==
NULL)
997 prev_fname = tf.
name;
998 else if (strcmp(tf.
name,prev_fname)) {
1005 for (
size_t i = 0; i < ftxt->
nspans; i++) {
1007 mxysize = maxoffset = mxfsize = 0;
1008 for (
size_t j = 0; j < ftxt->
spans[i].
nitems; j++) {
1048 mxfsize =
MAX(tf.
size, mxfsize);
1049 mxysize =
MAX(sz.
y, mxysize);
1073 ftxt->
spans[i].
lfsize = mxfsize + ysize - curbline - maxoffset;
1076 xsize =
MAX(width, xsize);
1081 ftxt->
box.
UR.
y = mxysize;
1100 if (b.
UR.
x == -1 && b.
UR.
y == -1) {
1103 agerrorf(
"No or improper image file=\"%s\"\n", img->
src);
1131 if (
parent->cellborder >= 0)
1151 sz.
x = child_sz.
x + margin;
1152 sz.
y = child_sz.
y + margin;
1157 agwarningf(
"cell size too small for content\n");
1164 "fixed cell size with unspecified width or height\n");
1181 for (c = lastc; c >= col; c--) {
1190 for (j = col; j < col + cellp->
colspan; j++) {
1196 return (uint16_t)col;
1252 n_cols =
MAX(c, n_cols);
1273#define SPLIT(x,n,s) (((x) - ((s)-1)*((n)-1)) / (n))
1290 for (cells = tbl->
u.
n.
cells; *cells; cells++) {
1359 const int sz_as_int = sz > INT_MAX ? INT_MAX :
1360 sz < INT_MIN ? INT_MIN : (int)sz;
1390 agxbuf value_buffer = {0};
1407 for (
size_t i = 0; i <= tbl->
row_count; i++) {
1421 for (cells = tbl->
u.
n.
cells; *cells; cells++) {
1497 rank(rowg, 2, INT_MAX);
1498 rank(colg, 2, INT_MAX);
1520 for (
size_t i = 0; i < ftxt->
nspans; i++) {
1539 delx = pos.
UR.
x - pos.
LL.
x - oldsz.
x;
1543 pos.
UR.
x = pos.
LL.
x + oldsz.
x;
1550 pos.
LL.
x += delx / 2;
1551 pos.
UR.
x -= delx / 2;
1555 dely = pos.
UR.
y - pos.
LL.
y - oldsz.
y;
1559 pos.
UR.
y = pos.
LL.
y + oldsz.
y;
1566 pos.
LL.
y += dely / 2;
1567 pos.
UR.
y -= dely / 2;
1586 delx = cbox.
UR.
x - cbox.
LL.
x - oldsz.
x;
1600 dely = cbox.
UR.
y - cbox.
LL.
y - oldsz.
y;
1619 delx = cbox.
UR.
x - cbox.
LL.
x - oldsz.
x;
1632 cbox.
LL.
x += delx / 2;
1633 cbox.
UR.
x -= delx / 2;
1638 dely = cbox.
UR.
y - cbox.
LL.
y - oldsz.
y;
1648 cbox.
LL.
y += dely / 2;
1649 cbox.
UR.
y -= dely / 2;
1689 double delx = fmax(pos.
UR.
x - pos.
LL.
x - oldsz, 0);
1691 double dely = fmax(pos.
UR.
y - pos.
LL.
y - oldsz, 0);
1698 pos.
UR.
x = pos.
LL.
x + oldsz;
1705 pos.
LL.
x += delx / 2;
1706 pos.
UR.
x -= delx / 2;
1714 pos.
UR.
y = pos.
LL.
y + oldsz;
1718 pos.
UR.
y = pos.
LL.
y + oldsz;
1721 pos.
LL.
y += dely / 2;
1722 pos.
UR.
y -= dely / 2;
1735 delx = tbl->
widths[i] + extra + ((i <= INT_MAX && (int)i < plus) ? 1 : 0);
1743 for (
size_t i = 0; i <= tbl->
row_count; i++) {
1744 dely = tbl->
heights[i] + extra + ((i <= INT_MAX && (int)i < plus) ? 1 : 0);
1749 while ((cp = *cells++)) {
1750 unsigned char mask = 0;
1804 for (
size_t i = 0; i < tbl->
row_count; i++)
1810 agwarningf(
"table size too small for content\n");
1817 "fixed table size with unspecified width or height\n");
1856 fprintf(stderr,
" ");
1859void printBox(
boxf b)
1861 fprintf(stderr,
"(%f,%f)(%f,%f)", b.
LL.
x, b.
LL.
y, b.
UR.
x, b.
UR.
y);
1867 fprintf(stderr,
"img: %s\n", ip->
src);
1874 for (
size_t i = 0; i < txt->
nspans; i++) {
1878 for (
size_t j = 0; j < txt->
spans[i].
nitems; j++) {
1880 fprintf(stderr,
"[%" PRISIZE_T "] (%f,%f) \"%s\" ",
1885 fprintf(stderr,
"font %s color %s size %f\n",
1890 fprintf(stderr,
"\n");
1914 fprintf(stderr,
"%c", c);
1926 fprintf(stderr,
"%c ", c);
1936 fputs(
"\n", stderr);
1938 printCell(*cells++, ind + 1);
1941static void printCell(
htmlcell_t * cp,
int ind)
1944 fprintf(stderr,
"cell %" PRIu16
" %" PRIu16
" %" PRIu16
" %" PRIu16
" ", cp->
colspan,
1947 fputs(
"\n", stderr);
1976 if ((
str =
agget(obj,
"pencolor")) != 0 &&
str[0])
1978 else if ((
str =
agget(obj,
"color")) != 0 &&
str[0])
2047 boxf b = {{-wd2, -ht2}, {wd2, ht2}};
2055 boxf b = {{-wd2, -ht2}, {wd2, ht2}};
static void agxbfree(agxbuf *xb)
free any malloced resources
static size_t agxbput(agxbuf *xb, const char *s)
append string s into xb
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
static char * agxbuse(agxbuf *xb)
Memory allocation wrappers that exit on failure.
static char * gv_strdup(const char *original)
static void * gv_calloc(size_t nmemb, size_t size)
CDT_API Dtlink_t * dtflatten(Dt_t *)
CDT_API int dtclose(Dt_t *)
char * latin1ToUTF8(char *s)
Converts string from Latin1 encoding to utf8. Also translates HTML entities.
char * htmlEntityUTF8(char *s, graph_t *g)
int initMapData(GVJ_t *job, char *lbl, char *url, char *tooltip, char *target, char *id, void *gobj)
obj_state_t * push_obj_state(GVJ_t *job)
void emit_map_rect(GVJ_t *job, boxf b)
void pop_obj_state(GVJ_t *job)
char * getObjId(GVJ_t *job, void *obj, agxbuf *xb)
Use id of root graph if any, plus kind and internal id of object.
bool findStopColor(char *colorlist, char *clrs[2], double *frac)
static pointf scale(double c, pointf p)
static int cnt(Dict_t *d, Dtlink_t **set)
char * agget(void *obj, char *name)
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
#define agfindedge(g, t, h)
void agwarningf(const char *fmt,...)
void agerrorf(const char *fmt,...)
int agisdirected(Agraph_t *g)
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Agdesc_t Agstrictdirected
strict directed. A strict graph cannot have multi-edges or self-arcs.
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
Agraph_t * agraphof(void *obj)
char * agnameof(void *)
returns a string descriptor for the object.
void * agbindrec(void *obj, const char *name, unsigned int recsize, int move_to_front)
attaches a new record of the given size to the object
static void indent(int ix)
#define EMIT_CLUSTERS_LAST
static void color(Agraph_t *g)
void gvrender_end_label(GVJ_t *job)
void gvrender_usershape(GVJ_t *job, char *name, pointf *AF, size_t n, bool filled, char *imagescale, char *imagepos)
void gvrender_set_style(GVJ_t *job, char **s)
void gvrender_set_fillcolor(GVJ_t *job, char *name)
void gvrender_polyline(GVJ_t *job, pointf *AF, size_t n)
point gvusershape_size(graph_t *g, char *name)
void gvrender_box(GVJ_t *job, boxf BF, int filled)
void gvrender_set_gradient_vals(GVJ_t *job, char *stopcolor, int angle, double frac)
void gvrender_begin_anchor(GVJ_t *job, char *href, char *tooltip, char *target, char *id)
void gvrender_end_anchor(GVJ_t *job)
void gvrender_textspan(GVJ_t *job, pointf p, textspan_t *span)
void gvrender_begin_label(GVJ_t *job, label_type type)
void gvrender_set_penwidth(GVJ_t *job, double penwidth)
void gvrender_set_pencolor(GVJ_t *job, char *name)
htmllabel_t * parseHTML(char *txt, int *warn, htmlenv_t *env)
static void free_html_img(htmlimg_t *ip)
static void endAnchor(GVJ_t *job, htmlmap_data_t *save)
static int size_html_tbl(graph_t *g, htmltbl_t *tbl, htmlcell_t *parent, htmlenv_t *env)
static void pos_html_cell(htmlcell_t *cp, boxf pos, unsigned char sides)
static void pushFontInfo(htmlenv_t *env, textfont_t *fp, textfont_t *savp)
static void pos_html_txt(htmltxt_t *ftxt, char c)
static char * nameOf(void *obj, agxbuf *xb)
static void closeGraphs(graph_t *rowg, graph_t *colg)
static void allocObj(GVJ_t *job)
boxf * html_port(node_t *n, char *pname, unsigned char *sides)
static void pos_html_tbl(htmltbl_t *, boxf, unsigned char)
static double heightOfLbl(htmllabel_t *lp)
int make_html_label(void *obj, textlabel_t *lp)
static void emit_html_img(GVJ_t *job, htmlimg_t *cp, htmlenv_t *env)
static void pos_html_img(htmlimg_t *cp, boxf pos)
#define DEFAULT_CELLSPACING
#define DEFAULT_CELLPADDING
static int size_html_cell(graph_t *g, htmlcell_t *cp, htmltbl_t *parent, htmlenv_t *env)
static void doBorder(GVJ_t *job, htmldata_t *dp, boxf b)
static pointf * mkPts(pointf *AF, boxf b, int border)
static void freeObj(GVJ_t *job)
static void setSizes(htmltbl_t *tbl, graph_t *rowg, graph_t *colg)
static int processTbl(graph_t *g, htmltbl_t *tbl, htmlenv_t *env)
static htmldata_t * portToTbl(htmltbl_t *, char *)
static void emit_html_txt(GVJ_t *job, htmltxt_t *tp, htmlenv_t *env)
static htmldata_t * portToCell(htmlcell_t *cp, char *id)
void free_html_text(htmltxt_t *t)
static void free_html_cell(htmlcell_t *cp)
static void emit_html_tbl(GVJ_t *job, htmltbl_t *tbl, htmlenv_t *env)
static void popFontInfo(htmlenv_t *env, textfont_t *savp)
static void makeGraphs(htmltbl_t *tbl, graph_t *rowg, graph_t *colg)
static int size_html_txt(GVC_t *gvc, htmltxt_t *ftxt, htmlenv_t *env)
void free_html_label(htmllabel_t *lp, int root)
static void emit_html_cell(GVJ_t *job, htmlcell_t *cp, htmlenv_t *env)
static uint16_t findCol(PointSet *ps, int row, int col, htmlcell_t *cellp)
void emit_html_label(GVJ_t *job, htmllabel_t *lp, textlabel_t *tp)
static void emit_htextspans(GVJ_t *job, size_t nspans, htextspan_t *spans, pointf p, double halfwidth_x, textfont_t finfo, boxf b, int simple)
static int initAnchor(GVJ_t *job, htmlenv_t *env, htmldata_t *data, boxf b, htmlmap_data_t *save)
void free_html_data(htmldata_t *dp)
static void sizeLinearArray(htmltbl_t *tbl)
static int setFill(GVJ_t *job, char *color, int angle, htmlstyle_t style, char *clrs[2])
static void doSide(GVJ_t *job, pointf p, double wd, double ht)
static void checkChain(graph_t *g)
static void sizeArray(htmltbl_t *tbl)
static void checkEdge(graph_t *g, node_t *t, node_t *h, double sz)
static void emit_html_rules(GVJ_t *job, htmlcell_t *cp, htmlenv_t *env, char *color, htmlcell_t *nextc)
static void free_html_tbl(htmltbl_t *tbl)
static int size_html_img(htmlimg_t *img, htmlenv_t *env)
static char * getPenColor(void *obj)
int inIntSet(Dt_t *is, size_t v)
void addIntSet(Dt_t *is, size_t v)
char * strdup_and_subst_obj(char *str, void *obj)
void make_simple_label(GVC_t *gvc, textlabel_t *lp)
int rank(graph_t *g, int balance, int maxiter)
void addPS(PointSet *ps, double x, double y)
void freePS(PointSet *ps)
int isInPS(PointSet *ps, double x, double y)
point containers PointSet and PointMap
static void printData(object_t *objs, size_t n_objs, xlabel_t *lbls, size_t n_lbls, label_params_t *params)
#define PRISIZE_T
PRIu64 alike for printing size_t
void round_corners(GVJ_t *job, pointf *AF, size_t sides, graphviz_polygon_style_t style, int filled)
Handle some special graphical cases, such as rounding the shape, adding diagonals at corners,...
pointf textspan_size(GVC_t *gvc, textspan_t *span)
Estimates size of a textspan, in points.
platform abstraction for case-insensitive string functions
Agraph_t * root
subgraphs - ancestors
size_t row_count
number of rows
double * widths
widths of the columns
struct htmltbl_t::@75::@76 n
struct htmltbl_t::@75::@77 p
double * heights
heights of the rows
size_t column_count
number of columns
unsigned explicit_tooltip
PostscriptAlias * postscript_alias
double yoffset_centerline
void(* free_layout)(void *layout)
#define elist_append(item, L)
#define alloc_elist(n, L)