]> granicus.if.org Git - graphviz/commitdiff
Initial implementation of rounded corners for tables
authorerg <devnull@localhost>
Fri, 4 Feb 2011 18:52:31 +0000 (18:52 +0000)
committererg <devnull@localhost>
Fri, 4 Feb 2011 18:52:31 +0000 (18:52 +0000)
lib/common/htmllex.c
lib/common/htmltable.c
lib/common/htmltable.h

index 99eac0392089217543f9e31d69f9e03fb80facfe..b8be61f4ef1f1b77d28ff6175d55ddef7bbc4bc0 100644 (file)
@@ -135,6 +135,19 @@ static int portfn(htmldata_t * p, char *v)
     return 0;
 }
 
+static int stylefn(htmltbl_t * p, char *v)
+{
+    int rv = 0;
+    char c = toupper(*v);
+    if ((c == 'R') && !strcasecmp(v + 1, "OUNDED"))
+       p->style = ROUNDED;
+    else {
+       agerr(AGWARN, "Illegal value %s for STYLE - ignored\n", v);
+       rv = 1;
+    }
+    return rv;
+}
+
 static int targetfn(htmldata_t * p, char *v)
 {
     p->target = strdup(v);
@@ -404,6 +417,7 @@ static attr_item tbl_items[] = {
     {"href", (attrFn) hreffn},
     {"id", (attrFn) idfn},
     {"port", (attrFn) portfn},
+    {"style", (attrFn) stylefn},
     {"target", (attrFn) targetfn},
     {"title", (attrFn) titlefn},
     {"tooltip", (attrFn) titlefn},
index edb1ffd70958374f6bdae2cbcf3539f154d7a80a..677f9f53091a7948fcec15ef98ae357f40f80f84 100644 (file)
@@ -372,11 +372,25 @@ emit_html_tbl(GVJ_t * job, htmltbl_t * tbl, htmlenv_t * env)
     else
        anchor = 0;
 
-    if (tbl->data.bgcolor)
-       doFill(job, tbl->data.bgcolor, pts);
+    if (tbl->style & ROUNDED) {
+       pointf AF[4];
+       char* color = (tbl->data.pencolor ? tbl->data.pencolor : DEFAULT_COLOR);
+       AF[0] = pts.LL;
+       AF[2] = pts.UR;
+       AF[1].x = AF[2].x;
+       AF[1].y = AF[0].y;
+       AF[3].x = AF[0].x;
+       AF[3].y = AF[2].y;
+       round_corners (job, tbl->data.bgcolor, color, AF, 4, tbl->style,
+           (tbl->data.bgcolor != NULL));
+    }
+    else {
+       if (tbl->data.bgcolor)
+           doFill(job, tbl->data.bgcolor, pts);
 
-    if (tbl->data.border)
-       doBorder(job, tbl->data.pencolor, tbl->data.border, pts);
+       if (tbl->data.border)
+           doBorder(job, tbl->data.pencolor, tbl->data.border, pts);
+    }
 
     while (*cells) {
        emit_html_cell(job, *cells, env);
index 5ae805cbaee615ca8e34c250bfb5218fb0ff3576..7185d8470e6bae6d9fd7284e510fc9504920adec 100644 (file)
@@ -105,6 +105,7 @@ extern "C" {
        int rc;                 /* number of rows */
        int cc;                 /* number of columns */
        htmlfont_t *font;       /* font info */
+       unsigned char style;
     };
 
     struct htmllabel_t {