]> granicus.if.org Git - graphviz/commitdiff
Allow renderers to specificy padding around graph. Use 0. for -Txdot
authorellson <devnull@localhost>
Tue, 8 Aug 2006 17:24:36 +0000 (17:24 +0000)
committerellson <devnull@localhost>
Tue, 8 Aug 2006 17:24:36 +0000 (17:24 +0000)
lib/common/emit.c
lib/gvc/gvcjob.h
plugin/core/gvrender_core_dot.c
plugin/core/gvrender_core_fig.c
plugin/core/gvrender_core_map.c
plugin/core/gvrender_core_ps.c
plugin/core/gvrender_core_svg.c
plugin/gd/gvrender_gd.c
plugin/gd/gvrender_gd_vrml.c
plugin/pango/gvrender_pango.c

index 0a9a6fd9909a7dbce0c4321cc95450c076a0b7fe..be5afd36c7b32e5b84c7afe32719574ea337bb2b 100644 (file)
@@ -1798,6 +1798,18 @@ static void init_gvc(GVC_t * gvc, graph_t * g)
     gvc->graphname = g->name;
 }
 
+static void init_job_pad(GVJ_t *job)
+{
+    switch (job->output_lang) {
+    case GVRENDER_PLUGIN:
+       job->pad.x = job->pad.y = job->render.features->default_pad;
+       break;
+    default:
+       job->pad.x = job->pad.y = DEFAULT_GRAPH_PAD;
+       break;
+    }
+}
+
 static void init_job_margin(GVJ_t *job)
 {
     GVC_t *gvc = job->gvc;
@@ -1819,6 +1831,7 @@ static void init_job_margin(GVJ_t *job)
             break;
         }
     }
+
 }
 
 static void init_job_dpi(GVJ_t *job, graph_t *g)
@@ -1855,9 +1868,6 @@ static void init_job_viewport(GVJ_t * job, graph_t * g)
     assert((gvc->bb.LL.x == 0) && (gvc->bb.LL.y == 0));
     P2PF(gvc->bb.UR, UR);
 
-    /* may want to take this from an attribute someday */
-    job->pad.x = job->pad.y = DEFAULT_GRAPH_PAD;
-
     job->bb.LL.x = -job->pad.x;           /* job->bb is bb of graph and padding - graph units */
     job->bb.LL.y = -job->pad.y;
     job->bb.UR.x = UR.x + job->pad.x;
@@ -2516,6 +2526,7 @@ static void emit_job(GVJ_t * job, graph_t * g)
 #endif
 
     init_job_flags(job, g);
+    init_job_pad(job);
     init_job_margin(job);
     init_job_dpi(job, g);
     init_job_viewport(job, g);
index 3e129c044a97337b1cc7a6a6fb58c34e90507409..1cd30963a09592b766a4b466402130c43955919d 100644 (file)
@@ -66,7 +66,9 @@ extern "C" {
 
     typedef struct {
        int flags;
-       double default_margin; /* graph units */
+       double default_margin;  /* points */
+       double default_pad;     /* graph units */
+       point  default_size;    /* default height, width - device units */
        pointf default_dpi;
        char **knowncolors;
        int sz_knowncolors;
index 73a9f613021289ef168a49134ac3cf42e9617d46..f96395b7abe49e0c19f16fc2c3d1c5530d0c106e 100644 (file)
@@ -314,6 +314,8 @@ gvrender_engine_t xdot_engine = {
 gvrender_features_t canon_features = {
     LAYOUT_NOT_REQUIRED,       /* flags */
     0.,                                /* default margin - points */
+    0.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {72.,72.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -325,6 +327,8 @@ gvrender_features_t canon_features = {
 gvrender_features_t dot_features = {
     0,                         /* flags */
     0.,                                /* default margin - points */
+    0.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {72.,72.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
index 4cd89c8407d562dd2026e57a3a59a637efa856f9..aa9e2a408646566cdd9f999b9162867aa60c2b38 100644 (file)
@@ -515,6 +515,8 @@ gvrender_features_t fig_features = {
     EMIT_COLORS
        | GVRENDER_Y_GOES_DOWN, /* flags */
     DEFAULT_EMBED_MARGIN,      /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {1440.,1440.},             /* default dpi */
         /* FIXME - this default dpi is a very strange number!!!
          * It was picked to make .png usershapes the right size on my screen.
index 3e68058a4271fdb88098aba9cf7b216d4342ebe6..b496a61aa3287f34d51cc37d0a0ef896cdb948e4 100644 (file)
@@ -285,6 +285,8 @@ static gvrender_features_t map_features = {
        | GVRENDER_DOES_MAP_CIRCLE
        | GVRENDER_DOES_MAP_POLYGON,
     0,                         /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {96.,96.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -301,6 +303,8 @@ static gvrender_features_t map_features_nopoly = {
        | GVRENDER_DOES_TOOLTIPS
        | GVRENDER_DOES_MAP_RECTANGLE,
     0,                         /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {96.,96.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
index 4b525a61277b00202fe5a68303180925b5576204..38a9ddb5a33f3a521e969ed67cfd27dc98b55182 100644 (file)
@@ -496,6 +496,8 @@ static gvrender_features_t psgen_features = {
        | GVRENDER_DOES_MAPS
        | GVRENDER_DOES_MAP_RECTANGLE,
     36,                                /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {72.,72.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
index f23ee57dd5a13eafe09be05d48e214868b64f3ed..5cd584499577cf784e40ac398e219e13c411050d 100644 (file)
@@ -446,6 +446,8 @@ gvrender_features_t svg_features = {
        | GVRENDER_DOES_TARGETS
        | GVRENDER_DOES_TOOLTIPS, /* flags */
     DEFAULT_EMBED_MARGIN,      /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {96.,96.},                 /* default dpi */
     svg_knowncolors,           /* knowncolors */
     sizeof(svg_knowncolors) / sizeof(char *),  /* sizeof knowncolors */
index 52c5550d5ca090fdb77ac898cd490bca1b676ca9..0bd05afb740509696aec7a8b18e29026df6e25c2 100644 (file)
@@ -570,6 +570,8 @@ static gvrender_features_t gdgen_features_tc = {
     GVRENDER_DOES_TRUECOLOR
        | GVRENDER_Y_GOES_DOWN, /* flags */
     0,                         /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {96.,96.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -581,6 +583,8 @@ static gvrender_features_t gdgen_features_tc = {
 static gvrender_features_t gdgen_features = {
     GVRENDER_Y_GOES_DOWN,      /* flags */
     0,                         /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {96.,96.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
index cc9f050b2c7cbb0e76fa7bde3c032992272f3139..6977c3a7ae24e76a89ce181985b26bf99643ed33 100644 (file)
@@ -833,6 +833,8 @@ static gvrender_engine_t vrml_engine = {
 static gvrender_features_t vrml_features = {
     GVRENDER_DOES_Z,           /* flags */
     0,                          /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {72.,72.},                  /* default dpi */
     NULL,                       /* knowncolors */
     0,                          /* sizeof knowncolors */
index 461f28e0cf209b112801b88981759c10bea877d0..18bbdb2cf64b340a04db13ee564c44d2994e4145 100644 (file)
@@ -407,6 +407,8 @@ static gvrender_features_t cairogen_features = {
        | GVRENDER_Y_GOES_DOWN
        | GVRENDER_DOES_TRANSFORM, /* flags */
     0,                         /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {96.,96.},                 /* default dpi */
     0,                         /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -420,6 +422,8 @@ static gvrender_features_t cairogen_features_ps = {
        | GVRENDER_Y_GOES_DOWN
        | GVRENDER_DOES_TRANSFORM, /* flags */
     36,                                /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {72.,72.},                 /* postscript 72 dpi */
     0,                         /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -434,6 +438,8 @@ static gvrender_features_t cairogen_features_x = {
        | GVRENDER_DOES_TRANSFORM
        | GVRENDER_X11_EVENTS,  /* flags */
     0,                         /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {72.,72.},                 /* default dpi */
     0,                         /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -448,6 +454,8 @@ static gvrender_features_t cairogen_features_gtk = {
        | GVRENDER_DOES_TRANSFORM
        | GVRENDER_X11_EVENTS,  /* flags */
     0,                         /* default margin - points */
+    4.,                         /* default pad - graph units */
+    {0,0},                      /* default height, width - device units */
     {72.,72.},                 /* default dpi */
     0,                         /* knowncolors */
     0,                         /* sizeof knowncolors */