Graphviz  2.29.20120524.0446
lib/gvc/gvcint.h
Go to the documentation of this file.
00001 /* $Id$ $Revision$ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /*************************************************************************
00005  * Copyright (c) 2011 AT&T Intellectual Property 
00006  * All rights reserved. This program and the accompanying materials
00007  * are made available under the terms of the Eclipse Public License v1.0
00008  * which accompanies this distribution, and is available at
00009  * http://www.eclipse.org/legal/epl-v10.html
00010  *
00011  * Contributors: See CVS logs. Details at http://www.graphviz.org/
00012  *************************************************************************/
00013 
00014 /* Common header used by both clients and plugins */
00015 
00016 #ifndef GVCINT_H
00017 #define GVCINT_H
00018 
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023 #include "gvcommon.h"
00024 #include "color.h"
00025 
00026     /* active plugin headers */
00027     typedef struct gvplugin_active_layout_s {
00028         gvlayout_engine_t *engine;
00029         int id;
00030         gvlayout_features_t *features;
00031         const char *type;
00032     } gvplugin_active_layout_t;
00033 
00034     typedef struct gvplugin_active_textlayout_s {
00035         gvtextlayout_engine_t *engine;
00036         int id;
00037         char *type;
00038     } gvplugin_active_textlayout_t;
00039 
00040     typedef struct gvplugin_package_s gvplugin_package_t;
00041 
00042     struct gvplugin_package_s {
00043         gvplugin_package_t *next;
00044         char *path;
00045         char *name;
00046     };
00047 
00048     struct gvplugin_available_s {
00049         gvplugin_available_t *next;     /* next plugin in linked list, or NULL */
00050         const char *typestr;            /* type string, e.g. "png" or "ps" */
00051         int quality;                    /* Programmer assigned quality ranking within type (+ve or -ve int).
00052                                         First implementation of type should be given "0" quality */
00053         gvplugin_package_t *package;    /* details of library containing plugin */
00054         gvplugin_installed_t *typeptr;  /* pointer to jumptable for plugin,
00055                                         or NULL if not yet loaded */
00056     };
00057 
00058     typedef struct GVG_s GVG_t;
00059 
00060     struct GVG_s {
00061         GVC_t *gvc;     /* parent gvc */
00062         GVG_t *next;    /* next gvg in list */
00063 
00064         char *input_filename; /* or NULL if stdin */
00065         int graph_index;  /* index of graph within input_file */
00066         graph_t *g;
00067     };
00068 
00069 #define MAXNEST 4
00070 
00071     struct GVC_s {
00072         GVCOMMON_t common;
00073 
00074         char *config_path;
00075         boolean config_found;
00076 
00077         /* gvParseArgs */
00078         char **input_filenames; /* null terminated array of input filenames */
00079 
00080         /* gvNextInputGraph() */
00081         GVG_t *gvgs;    /* linked list of graphs */
00082         GVG_t *gvg;     /* current graph */
00083 
00084         /* plugins */
00085 #define ELEM(x) +1
00086         /* APIS expands to "+1 +1 ... +1" to give the number of APIs */
00087         gvplugin_available_t *apis[ APIS ]; /* array of linked-list of plugins per api */
00088         gvplugin_available_t *api[ APIS ];  /* array of current plugins per api */
00089 #undef ELEM
00090         gvplugin_package_t *packages;   /* list of available packages */
00091 
00092         /* keybindings for keyboard events */
00093         gvevent_key_binding_t *keybindings;
00094         int numkeys;
00095         void *keycodes;
00096 
00097         /* externally provided write() displine */
00098         size_t (*write_fn) (GVJ_t *job, const char *s, size_t len);
00099 
00100 /* FIXME - everything below should probably move to GVG_t */
00101 
00102         /* gvrender_config() */
00103         GVJ_t *jobs;    /* linked list of jobs */
00104         GVJ_t *job;     /* current job */
00105 
00106         graph_t *g;      /* current graph */
00107 
00108         /* gvrender_begin_job() */
00109         gvplugin_active_textlayout_t textlayout;
00110         gvplugin_active_layout_t layout;
00111 
00112         char *graphname;        /* name from graph */
00113         GVJ_t *active_jobs;   /* linked list of active jobs */
00114 
00115         /* pagination */
00116         char *pagedir;          /* pagination order */
00117         pointf margin;          /* margins in graph units */
00118         pointf pad;             /* pad in graph units */
00119         pointf pageSize;        /* pageSize in graph units, not including margins */
00120         point pb;               /* page size - including margins (inches) */
00121         boxf bb;                /* graph bb in graph units, not including margins */
00122         int rotation;           /* rotation - 0 = portrait, 90 = landscape */
00123         boolean graph_sets_pad, graph_sets_margin, graph_sets_pageSize, graph_sets_rotation;
00124 
00125         /* layers */
00126         char *layerDelims;      /* delimiters in layer names */
00127         char *layerListDelims;  /* delimiters between layer ranges */ 
00128         char *layers;           /* null delimited list of layer names */
00129         char **layerIDs;        /* array of layer names */
00130         int numLayers;          /* number of layers */
00131         int *layerlist;
00132 
00133         /* default font */
00134         char *defaultfontname;
00135         double defaultfontsize;
00136 
00137         /* default line style */
00138         char **defaultlinestyle;
00139 
00140         /* render defaults set from graph */
00141         gvcolor_t bgcolor;      /* background color */
00142 
00143         /* whether to mangle font names (at least in SVG), usually false */
00144         int fontrenaming;
00145     };
00146 
00147 #ifdef WIN32
00148 #define DIRSEP "\\"
00149 #else
00150 #define DIRSEP "/"
00151 #endif
00152 
00153 #ifdef __cplusplus
00154 }
00155 #endif
00156 #endif                          /* GVCINT_H */