1 /* $Id$ $Revision$ */ 2 /* vim:set shiftwidth=4 ts=8: */ 3 4 /************************************************************************* 5 * Copyright (c) 2011 AT&T Intellectual Property 6 * All rights reserved. This program and the accompanying materials 7 * are made available under the terms of the Eclipse Public License v1.0 8 * which accompanies this distribution, and is available at 9 * http://www.eclipse.org/legal/epl-v10.html 10 * 11 * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 *************************************************************************/ 13 14 /* Common header used by both clients and plugins */ 15 16 #ifndef GVCINT_H 17 #define GVCINT_H 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 #include "cdt.h" 24 #include "gvcommon.h" 25 #include "gvcjob.h" 26 #include "color.h" 27 28 /* active plugin headers */ 29 typedef struct gvplugin_active_layout_s { 30 gvlayout_engine_t *engine; 31 int id; 32 gvlayout_features_t *features; 33 const char *type; 34 } gvplugin_active_layout_t; 35 36 typedef struct gvplugin_active_textlayout_s { 37 gvtextlayout_engine_t *engine; 38 int id; 39 char *type; 40 } gvplugin_active_textlayout_t; 41 42 typedef struct gvplugin_package_s gvplugin_package_t; 43 44 struct gvplugin_package_s { 45 gvplugin_package_t *next; 46 char *path; 47 char *name; 48 }; 49 50 struct gvplugin_available_s { 51 gvplugin_available_t *next; /* next plugin in linked list, or NULL */ 52 char *typestr; /* type string, e.g. "png" or "ps" */ 53 int quality; /* Programmer assigned quality ranking within type (+ve or -ve int). 54 First implementation of type should be given "0" quality */ 55 gvplugin_package_t *package; /* details of library containing plugin */ 56 gvplugin_installed_t *typeptr; /* pointer to jumptable for plugin, 57 or NULL if not yet loaded */ 58 }; 59 60 struct GVG_s { 61 GVC_t *gvc; /* parent gvc */ 62 GVG_t *next; /* next gvg in list */ 63 64 char *input_filename; /* or NULL if stdin */ 65 int graph_index; /* index of graph within input_file */ 66 graph_t *g; 67 }; 68 69 #define MAXNEST 4 70 71 struct GVC_s { 72 GVCOMMON_t common; 73 74 char *config_path; 75 boolean config_found; 76 77 /* gvParseArgs */ 78 char **input_filenames; /* null terminated array of input filenames */ 79 80 /* gvNextInputGraph() */ 81 GVG_t *gvgs; /* linked list of graphs */ 82 GVG_t *gvg; /* current graph */ 83 84 /* plugins */ 85 #define ELEM(x) +1 86 /* APIS expands to "+1 +1 ... +1" to give the number of APIs */ 87 gvplugin_available_t *apis[ APIS ]; /* array of linked-list of plugins per api */ 88 gvplugin_available_t *api[ APIS ]; /* array of current plugins per api */ 89 #undef ELEM 90 gvplugin_package_t *packages; /* list of available packages */ 91 92 /* externally provided write() displine */ 93 size_t (*write_fn) (GVJ_t *job, const char *s, size_t len); 94 95 /* fonts and textlayout */ 96 Dtdisc_t textfont_disc; 97 Dt_t *textfont_dt; 98 gvplugin_active_textlayout_t textlayout; /* always use best avail for all jobs */ 99 // void (*free_layout) (void *layout); /* function for freeing layouts (mostly used by pango) */ 100 101 /* FIXME - everything below should probably move to GVG_t */ 102 103 /* gvrender_config() */ 104 GVJ_t *jobs; /* linked list of jobs */ 105 GVJ_t *job; /* current job */ 106 107 graph_t *g; /* current graph */ 108 109 /* gvrender_begin_job() */ 110 gvplugin_active_layout_t layout; 111 112 char *graphname; /* name from graph */ 113 GVJ_t *active_jobs; /* linked list of active jobs */ 114 115 /* pagination */ 116 char *pagedir; /* pagination order */ 117 pointf margin; /* margins in graph units */ 118 pointf pad; /* pad in graph units */ 119 pointf pageSize; /* pageSize in graph units, not including margins */ 120 point pb; /* page size - including margins (inches) */ 121 boxf bb; /* graph bb in graph units, not including margins */ 122 int rotation; /* rotation - 0 = portrait, 90 = landscape */ 123 boolean graph_sets_pad, graph_sets_margin, graph_sets_pageSize, graph_sets_rotation; 124 125 /* layers */ 126 char *layerDelims; /* delimiters in layer names */ 127 char *layerListDelims; /* delimiters between layer ranges */ 128 char *layers; /* null delimited list of layer names */ 129 char **layerIDs; /* array of layer names */ 130 int numLayers; /* number of layers */ 131 int *layerlist; 132 133 /* default font */ 134 char *defaultfontname; 135 double defaultfontsize; 136 137 /* default line style */ 138 char **defaultlinestyle; 139 140 /* render defaults set from graph */ 141 gvcolor_t bgcolor; /* background color */ 142 143 /* whether to mangle font names (at least in SVG), usually false */ 144 int fontrenaming; 145 }; 146 147 extern GVC_t* gvCloneGVC (GVC_t *); 148 extern void gvFreeCloneGVC (GVC_t *); 149 150 #ifdef _WIN32 151 #define DIRSEP "\\" 152 #else 153 #define DIRSEP "/" 154 #endif 155 156 #ifdef __cplusplus 157 } 158 #endif 159 #endif /* GVCINT_H */ 160