1 /* GNUPLOT - gadgets.h */
2 
3 /*[
4  * Copyright 2000, 2004   Thomas Williams, Colin Kelley
5  *
6  * Permission to use, copy, and distribute this software and its
7  * documentation for any purpose with or without fee is hereby granted,
8  * provided that the above copyright notice appear in all copies and
9  * that both that copyright notice and this permission notice appear
10  * in supporting documentation.
11  *
12  * Permission to modify the software is granted, but not the right to
13  * distribute the complete modified source code.  Modifications are to
14  * be distributed as patches to the released version.  Permission to
15  * distribute binaries produced by compiling modified sources is granted,
16  * provided you
17  *   1. distribute the corresponding source modifications from the
18  *    released version in the form of a patch file along with the binaries,
19  *   2. add special version identification to distinguish your version
20  *    in addition to the base release version number,
21  *   3. provide your name and address as the primary contact for the
22  *    support of your modified version, and
23  *   4. retain our contact information in regard to use of the base
24  *    software.
25  * Permission to distribute the released version of the source code along
26  * with corresponding source modifications in the form of a patch file is
27  * granted with same provisions 2 through 4 for binary distributions.
28  *
29  * This software is provided "as is" without express or implied warranty
30  * to the extent permitted by applicable law.
31 ]*/
32 
33 #ifndef GNUPLOT_GADGETS_H
34 # define GNUPLOT_GADGETS_H
35 
36 #include "syscfg.h"
37 
38 #include "term_api.h"
39 
40 /* Types and variables concerning graphical plot elements that are not
41  * *terminal-specific, are used by both* 2D and 3D plots, and are not
42  * *assignable to any particular * axis. I.e. they belong to neither
43  * *term_api, graphics, graph3d, nor * axis .h files.
44  */
45 
46 /* #if... / #include / #define collection: */
47 
48 /* Default point size is taken from the global "pointsize" variable */
49 #define PTSZ_DEFAULT    (-2)
50 #define PTSZ_VARIABLE   (-3)
51 #define AS_VARIABLE	(-3)
52 
53 /* Type definitions */
54 
55 /* Coordinate system specifications: x1/y1, x2/y2, graph-box relative
56  * or screen relative coordinate systems */
57 typedef enum position_type {
58     first_axes,
59     second_axes,
60     graph,
61     screen,
62     character,
63     polar_axes
64 } position_type;
65 
66 /* A full 3D position, with all 3 coordinates of possible using different axes.
67  * Used for 'set label', 'set arrow' positions and various offsets.
68  */
69 typedef struct position {
70     enum position_type scalex,scaley,scalez;
71     double x,y,z;
72 } t_position;
73 
74 /* Linked list of structures storing 'set label' information */
75 typedef struct text_label {
76     struct text_label *next;	/* pointer to next label in linked list */
77     int tag;			/* identifies the label */
78     t_position place;
79     enum JUSTIFY pos;		/* left/center/right horizontal justification */
80     int rotate;
81     int layer;
82     int boxed;			/* EAM_BOXED_TEXT */
83     char *text;
84     char *font;			/* Entry font added by DJL */
85     struct t_colorspec textcolor;
86     struct lp_style_type lp_properties;
87     struct position offset;
88     TBOOLEAN noenhanced;
89     TBOOLEAN hypertext;
90 } text_label;
91 
92 /* This is the default state for the axis, timestamp, and plot title labels
93  * indicated by tag = -2 */
94 #define NONROTATING_LABEL_TAG -2
95 #define ROTATE_IN_3D_LABEL_TAG -3
96 #define VARIABLE_ROTATE_LABEL_TAG -4
97 #define EMPTY_LABELSTRUCT \
98     {NULL, NONROTATING_LABEL_TAG, \
99      {character, character, character, 0.0, 0.0, 0.0}, CENTRE, 0, 0, \
100      0, \
101      NULL, NULL, {TC_LT, -2, 0.0}, DEFAULT_LP_STYLE_TYPE, \
102      {character, character, character, 0.0, 0.0, 0.0}, FALSE, \
103      FALSE}
104 
105 /* Datastructure for implementing 'set arrow' */
106 typedef enum arrow_type {
107     arrow_end_absolute,
108     arrow_end_relative,
109     arrow_end_oriented,
110     arrow_end_undefined
111     } arrow_type;
112 
113 typedef struct arrow_def {
114     struct arrow_def *next;	/* pointer to next arrow in linked list */
115     int tag;			/* identifies the arrow */
116     arrow_type type;		/* how to interpret t_position end */
117     t_position start;
118     t_position end;
119     double angle;		/* angle in degrees if type arrow_end_oriented */
120     struct arrow_style_type arrow_properties;
121 } arrow_def;
122 
123 #ifdef EAM_OBJECTS
124 /* The object types supported so far are OBJ_RECTANGLE, OBJ_CIRCLE, and OBJ_ELLIPSE */
125 typedef struct rectangle {
126     int type;			/* 0 = corners;  1 = center + size */
127     t_position center;		/* center */
128     t_position extent;		/* width and height */
129     t_position bl;		/* bottom left */
130     t_position tr;		/* top right */
131 } t_rectangle;
132 
133 #define DEFAULT_RADIUS (-1.0)
134 #define DEFAULT_ELLIPSE (-2.0)
135 typedef struct circle {
136     int type;			/* not used */
137     t_position center;		/* center */
138     t_position extent;		/* radius */
139     double arc_begin;
140     double arc_end;
141     TBOOLEAN wedge;		/* TRUE = connect arc ends to center */
142 } t_circle;
143 
144 #define ELLIPSEAXES_XY (0)
145 #define ELLIPSEAXES_XX (1)
146 #define ELLIPSEAXES_YY (2)
147 typedef struct ellipse {
148     int type;			/* mapping of axes: ELLIPSEAXES_XY, ELLIPSEAXES_XX or ELLIPSEAXES_YY */
149     t_position center;		/* center */
150     t_position extent;		/* major and minor axes */
151     double orientation;		/* angle of first axis to horizontal */
152 } t_ellipse;
153 
154 typedef struct polygon {
155     int	type;			/* Number of vertices */
156     t_position *vertex;		/* Array of vertices */
157 } t_polygon;
158 
159 typedef enum en_clip_object {
160     OBJ_CLIP,		/* Clip to graph unless coordinate type is screen */
161     OBJ_NOCLIP,	/* Clip to canvas, never to graph */
162     OBJ_ALWAYS_CLIP	/* Not yet implemented */
163 } t_clip_object;
164 
165 /* Datastructure for 'set object' */
166 typedef struct object {
167     struct object *next;
168     int tag;
169     int layer;			/* behind or back or front */
170     int object_type;		/* OBJ_RECTANGLE */
171     t_clip_object clip;
172     fill_style_type fillstyle;
173     lp_style_type lp_properties;
174     union o {t_rectangle rectangle; t_circle circle; t_ellipse ellipse; t_polygon polygon;} o;
175 } t_object;
176 #define OBJ_RECTANGLE (1)
177 #define OBJ_CIRCLE (2)
178 #define OBJ_ELLIPSE (3)
179 #define OBJ_POLYGON (4)
180 #endif
181 
182 /* Datastructure implementing 'set dashtype' */
183 struct custom_dashtype_def {
184     struct custom_dashtype_def *next;	/* pointer to next dashtype in linked list */
185     int tag;			/* identifies the dashtype */
186     int d_type;                 /* for DASHTYPE_SOLID or CUSTOM */
187     struct t_dashtype dashtype;
188 };
189 
190 /* Datastructure implementing 'set style line' */
191 struct linestyle_def {
192     struct linestyle_def *next;	/* pointer to next linestyle in linked list */
193     int tag;			/* identifies the linestyle */
194     struct lp_style_type lp_properties;
195 };
196 
197 /* Datastructure implementing 'set style arrow' */
198 struct arrowstyle_def {
199     struct arrowstyle_def *next;/* pointer to next arrowstyle in linked list */
200     int tag;			/* identifies the arrowstyle */
201     struct arrow_style_type arrow_properties;
202 };
203 
204 /* For 'set style parallelaxis' */
205 struct pa_style {
206     lp_style_type lp_properties;/* used to draw the axes themselves */
207     int layer;			/* front/back */
208 };
209 #define DEFAULT_PARALLEL_AXIS_STYLE \
210 	{{0, LT_BLACK, 0, DASHTYPE_SOLID, 0, 0, 2.0, 0.0, DEFAULT_P_CHAR, BLACK_COLORSPEC, DEFAULT_DASHPATTERN}, LAYER_FRONT }
211 
212 /* The stacking direction of the key box: (vertical, horizontal) */
213 typedef enum en_key_stack_direction {
214     GPKEY_VERTICAL,
215     GPKEY_HORIZONTAL
216 } t_key_stack_direction;
217 
218 /* The region, with respect to the border, key is located: (inside, outside) */
219 typedef enum en_key_region {
220     GPKEY_AUTO_INTERIOR_LRTBC,   /* Auto placement, left/right/top/bottom/center */
221     GPKEY_AUTO_EXTERIOR_LRTBC,   /* Auto placement, left/right/top/bottom/center */
222     GPKEY_AUTO_EXTERIOR_MARGIN,  /* Auto placement, margin plus lrc or tbc */
223     GPKEY_USER_PLACEMENT         /* User specified placement */
224 } t_key_region;
225 
226 /* If exterior, there are 12 possible auto placements.  Since
227    left/right/center with top/bottom/center can only define 9
228    locations, further subdivide the exterior region into four
229    subregions for which left/right/center (TMARGIN/BMARGIN)
230    and top/bottom/center (LMARGIN/RMARGIN) creates 12 locations. */
231 typedef enum en_key_ext_region {
232     GPKEY_TMARGIN,
233     GPKEY_BMARGIN,
234     GPKEY_LMARGIN,
235     GPKEY_RMARGIN
236 } t_key_ext_region;
237 
238 /* Key sample to the left or the right of the plot title? */
239 typedef enum en_key_sample_positioning {
240     GPKEY_LEFT,
241     GPKEY_RIGHT
242 } t_key_sample_positioning;
243 
244 typedef struct {
245     int opt_given; /* option given / not given (otherwise default) */
246     int closeto;   /* from list FILLEDCURVES_CLOSED, ... */
247     double at;	   /* value for FILLEDCURVES_AT... */
248     double aty;	   /* the other value for FILLEDCURVES_ATXY */
249     int oneside;   /* -1 if fill below bound only; +1 if fill above bound only */
250 } filledcurves_opts;
251 #define EMPTY_FILLEDCURVES_OPTS { 0, 0, 0.0, 0.0, 0 }
252 
253 typedef struct histogram_style {
254     int type;		/* enum t_histogram_type */
255     int gap;		/* set style hist gap <n> (space between clusters) */
256     int clustersize;	/* number of datasets in this histogram */
257     double start;	/* X-coord of first histogram entry */
258     double end;		/* X-coord of last histogram entry */
259     int startcolor;	/* LT_UNDEFINED or explicit color for first entry */
260     int startpattern;	/* LT_UNDEFINED or explicit pattern for first entry */
261     double bar_lw;	/* linewidth for error bars */
262     struct histogram_style *next;
263     struct text_label title;
264 } histogram_style;
265 typedef enum histogram_type {
266 	HT_NONE,
267 	HT_STACKED_IN_LAYERS,
268 	HT_STACKED_IN_TOWERS,
269 	HT_CLUSTERED,
270 	HT_ERRORBARS
271 } t_histogram_type;
272 #define DEFAULT_HISTOGRAM_STYLE { HT_CLUSTERED, 2, 1, 0.0, 0.0, LT_UNDEFINED, LT_UNDEFINED, 0, NULL, EMPTY_LABELSTRUCT }
273 
274 typedef enum en_boxplot_factor_labels {
275 	BOXPLOT_FACTOR_LABELS_OFF,
276 	BOXPLOT_FACTOR_LABELS_AUTO,
277 	BOXPLOT_FACTOR_LABELS_X,
278 	BOXPLOT_FACTOR_LABELS_X2
279 } t_boxplot_factor_labels;
280 
281 #define DEFAULT_BOXPLOT_FACTOR -1
282 
283 typedef struct boxplot_style {
284     int limit_type;	/* 0 = multiple of interquartile 1 = fraction of points */
285     double limit_value;
286     TBOOLEAN outliers;
287     int pointtype;
288     int plotstyle;	/* CANDLESTICKS or FINANCEBARS */
289     double median_linewidth;
290     double separation;	/* of boxplots if there are more than one factors */
291     t_boxplot_factor_labels labels;	/* Which axis to put the tic labels if there are factors */
292     TBOOLEAN sort_factors;	/* Sort factors in alphabetical order? */
293 } boxplot_style;
294 extern boxplot_style boxplot_opts;
295 #define DEFAULT_BOXPLOT_STYLE { 0, 1.5, TRUE, 6, CANDLESTICKS, -1.0, 1.0, BOXPLOT_FACTOR_LABELS_AUTO, FALSE }
296 
297 #ifdef EAM_BOXED_TEXT
298 typedef struct textbox_style {
299     TBOOLEAN opaque;	/* True if the box is background-filled before writing into it */
300     TBOOLEAN noborder;	/* True if you want fill only, no lines */
301     double xmargin;	/* fraction of default margin to use */
302     double ymargin;	/* fraction of default margin to use */
303     double linewidth;	/* applied to border */
304     t_colorspec border_color;	/* TC_LT + LT_NODRAW is "noborder" */
305     t_colorspec fillcolor;	/* only used if opaque is TRUE */
306 } textbox_style;
307 #define DEFAULT_TEXTBOX_STYLE { FALSE, FALSE, 1.0, 1.0, 1.0, BLACK_COLORSPEC, BACKGROUND_COLORSPEC }
308 #endif
309 
310 /***********************************************************/
311 /* Variables defined by gadgets.c needed by other modules. */
312 /***********************************************************/
313 
314 /* bounding box position, in terminal coordinates */
315 typedef struct {
316     int xleft;
317     int xright;
318     int ybot;
319     int ytop;
320 } BoundingBox;
321 
322 /* EAM Feb 2003 - Move all global variables related to key into a */
323 /* single structure. Eventually this will allow multiple keys.    */
324 
325 typedef enum keytitle_type {
326     NOAUTO_KEYTITLES, FILENAME_KEYTITLES, COLUMNHEAD_KEYTITLES
327 } keytitle_type;
328 
329 typedef struct {
330     TBOOLEAN visible;		/* Do we show this key at all? */
331     t_key_region region;	/* if so: where? */
332     t_key_ext_region margin;	/* if exterior: where outside? */
333     struct position user_pos;	/* if user specified position, this is it */
334     VERT_JUSTIFY vpos;		/* otherwise these guide auto-positioning */
335     JUSTIFY hpos;
336     TBOOLEAN fixed;		/* prevents key in 3D plot from rotating/scaling with plot */
337     t_key_sample_positioning just;
338     t_key_stack_direction stack_dir;
339     double swidth;		/* 'width' of the linestyle sample line in the key */
340     double vert_factor;		/* user specified vertical spacing multiplier */
341     double width_fix;		/* user specified additional (+/-) width of key titles */
342     double height_fix;
343     keytitle_type auto_titles;	/* auto title curves unless plotted 'with notitle' */
344     TBOOLEAN front;		/* draw key in a second pass after the rest of the graph */
345     TBOOLEAN reverse;		/* key back to front */
346     TBOOLEAN invert;		/* key top to bottom */
347     TBOOLEAN enhanced;		/* enable/disable enhanced text of key titles */
348     struct lp_style_type box;	/* linetype of box around key:  */
349     char *font;			/* Will be used for both key title and plot titles */
350     struct t_colorspec textcolor;	/* Will be used for both key title and plot titles */
351     BoundingBox bounds;
352     int maxcols;		/* maximum no of columns for horizontal keys */
353     int maxrows;		/* maximum no of rows for vertical keys */
354     text_label title;		/* holds title line for the key as a whole */
355 } legend_key;
356 
357 extern legend_key keyT;
358 
359 #define DEFAULT_KEYBOX_LP {0, LT_NODRAW, 0, DASHTYPE_SOLID, 0, 0, 1.0, PTSZ_DEFAULT, DEFAULT_P_CHAR, BLACK_COLORSPEC, DEFAULT_DASHPATTERN}
360 
361 #define DEFAULT_KEY_POSITION { graph, graph, graph, 0.9, 0.9, 0. }
362 
363 #define DEFAULT_KEY_PROPS \
364 		{ TRUE, \
365 		GPKEY_AUTO_INTERIOR_LRTBC, GPKEY_RMARGIN, \
366 		DEFAULT_KEY_POSITION, \
367 		JUST_TOP, RIGHT, TRUE, \
368 		GPKEY_RIGHT, GPKEY_VERTICAL, \
369 		4.0, 1.0, 0.0, 0.0, \
370 		FILENAME_KEYTITLES, \
371 		FALSE, FALSE, FALSE, TRUE, \
372 		DEFAULT_KEYBOX_LP, \
373 		NULL, {TC_LT, LT_BLACK, 0.0}, \
374 		{0,0,0,0}, 0, 0, \
375 		EMPTY_LABELSTRUCT}
376 
377 
378 /*
379  * EAM Jan 2006 - Move colorbox structure definition to here from color.h
380  * in order to be able to use struct position
381  */
382 
383 #define SMCOLOR_BOX_NO      'n'
384 #define SMCOLOR_BOX_DEFAULT 'd'
385 #define SMCOLOR_BOX_USER    'u'
386 
387 typedef struct {
388   char where;
389     /* where
390 	SMCOLOR_BOX_NO .. do not draw the colour box
391 	SMCOLOR_BOX_DEFAULT .. draw it at default position and size
392 	SMCOLOR_BOX_USER .. draw it at the position given by user
393     */
394   char rotation; /* 'v' or 'h' vertical or horizontal box */
395   char border; /* if non-null, a border will be drawn around the box (default) */
396   int border_lt_tag;
397   int layer; /* front or back */
398   int xoffset;	/* To adjust left or right, e.g. for y2tics */
399   struct position origin;
400   struct position size;
401   TBOOLEAN invert;	/* gradient low->high runs top->bot rather than bot->top */
402   BoundingBox bounds;
403 } color_box_struct;
404 
405 extern color_box_struct color_box;
406 extern color_box_struct default_color_box;
407 
408 /* Holder for various image properties */
409 typedef struct t_image {
410     t_imagecolor type; /* See above */
411     TBOOLEAN fallback; /* true == don't use terminal-specific code */
412     unsigned int ncols, nrows; /* image dimensions */
413 } t_image;
414 
415 extern BoundingBox plot_bounds;	/* Plot Boundary */
416 extern BoundingBox page_bounds;	/* 3D boundary prior to view transformation */
417 extern BoundingBox canvas; 	/* Writable area on terminal */
418 extern BoundingBox *clip_area;	/* Current clipping box */
419 
420 extern float xsize;		/* x scale factor for size */
421 extern float ysize;		/* y scale factor for size */
422 extern float zsize;		/* z scale factor for size */
423 extern float xoffset;		/* x origin setting */
424 extern float yoffset;		/* y origin setting */
425 extern float aspect_ratio;	/* 1.0 for square */
426 extern int aspect_ratio_3D;	/* 2 for equal scaling of x and y; 3 for z also */
427 
428 /* plot border autosizing overrides, in characters (-1: autosize) */
429 extern t_position lmargin, bmargin, rmargin, tmargin;
430 #define DEFAULT_MARGIN_POSITION {character, character, character, -1, -1, -1}
431 
432 extern struct custom_dashtype_def *first_custom_dashtype;
433 
434 extern struct arrow_def *first_arrow;
435 
436 extern struct text_label *first_label;
437 
438 extern struct linestyle_def *first_linestyle;
439 extern struct linestyle_def *first_perm_linestyle;
440 extern struct linestyle_def *first_mono_linestyle;
441 
442 extern struct arrowstyle_def *first_arrowstyle;
443 
444 extern struct pa_style parallel_axis_style;
445 
446 #ifdef EAM_OBJECTS
447 extern struct object *first_object;
448 #endif
449 
450 extern text_label title;
451 
452 extern text_label timelabel;
453 #ifndef DEFAULT_TIMESTAMP_FORMAT
454 /* asctime() format */
455 # define DEFAULT_TIMESTAMP_FORMAT "%a %b %d %H:%M:%S %Y"
456 #endif
457 extern int timelabel_bottom;
458 
459 extern TBOOLEAN	polar;
460 extern TBOOLEAN inverted_raxis;	/* true if R_AXIS.set_min > R_AXIS.set_max */
461 
462 #define ZERO 1e-8		/* default for 'zero' set option */
463 extern double zero;		/* zero threshold, not 0! */
464 
465 extern double pointsize;
466 extern double pointintervalbox;
467 extern t_colorspec background_fill;
468 
469 #define SOUTH		1 /* 0th bit */
470 #define WEST		2 /* 1th bit */
471 #define NORTH		4 /* 2th bit */
472 #define EAST		8 /* 3th bit */
473 #define border_east	(draw_border & EAST)
474 #define border_west	(draw_border & WEST)
475 #define border_south	(draw_border & SOUTH)
476 #define border_north	(draw_border & NORTH)
477 extern int draw_border;
478 extern int user_border;
479 extern int border_layer;
480 
481 extern struct lp_style_type border_lp;
482 extern const struct lp_style_type background_lp;
483 extern const struct lp_style_type default_border_lp;
484 
485 extern TBOOLEAN	clip_lines1;
486 extern TBOOLEAN	clip_lines2;
487 extern TBOOLEAN	clip_points;
488 
489 #define SAMPLES 100		/* default number of samples for a plot */
490 extern int samples_1;
491 extern int samples_2;
492 
493 extern double ang2rad; /* 1 or pi/180 */
494 
495 extern enum PLOT_STYLE data_style;
496 extern enum PLOT_STYLE func_style;
497 
498 extern TBOOLEAN parametric;
499 extern TBOOLEAN in_parametric;
500 
501 /* If last plot was a 3d one. */
502 extern TBOOLEAN is_3d_plot;
503 
504 /* A macro to check whether 2D functionality is allowed in the last plot:
505    either the plot is a 2D plot, or it is a suitably oriented 3D plot (e.g. map).
506 */
507 #define ALMOST2D      \
508     ( !is_3d_plot || splot_map || \
509       ( fabs(fmod(surface_rot_z,90.0))<0.1  \
510         && fabs(fmod(surface_rot_x,180.0))<0.1 ) )
511 
512 typedef enum E_Refresh_Allowed {
513    E_REFRESH_NOT_OK = 0,
514    E_REFRESH_OK_2D = 2,
515    E_REFRESH_OK_3D = 3
516 } TRefresh_Allowed;
517 
518 extern TRefresh_Allowed refresh_ok;
519 # define SET_REFRESH_OK(ok, nplots) do { \
520    refresh_ok = (ok); \
521    refresh_nplots = (nplots); \
522 } while(0)
523 extern int refresh_nplots;
524 
525 extern TBOOLEAN volatile_data;
526 
527 /* WINDOWID to be filled by terminals running on X11 (x11, wxt, qt, ...) */
528 extern int current_x11_windowid;
529 
530 /* Plot layer definitions are collected here. */
531 /* Someday they might actually be used.       */
532 #define LAYER_BEHIND     -1
533 #define LAYER_BACK        0
534 #define LAYER_FRONT       1
535 #define LAYER_FOREGROUND  2	/* not currently used */
536 #define LAYER_PLOT       16	/* currently used only by fig.trm */
537 #define LAYER_PLOTLABELS 99
538 
539 /* Functions exported by gadgets.c */
540 
541 /* moved here from util3d: */
542 int draw_clip_line __PROTO((int, int, int, int));
543 void draw_clip_polygon __PROTO((int , gpiPoint *));
544 void draw_clip_arrow __PROTO((int, int, int, int, int));
545 void clip_polygon __PROTO((gpiPoint *, gpiPoint *, int , int *));
546 int clip_point __PROTO((unsigned int, unsigned int));
547 void clip_put_text __PROTO((unsigned int, unsigned int, char *));
548 
549 /* moved here from graph3d: */
550 void clip_move __PROTO((unsigned int x, unsigned int y));
551 void clip_vector __PROTO((unsigned int x, unsigned int y));
552 
553 /* Common routines for setting line or text color from t_colorspec */
554 void apply_pm3dcolor __PROTO((struct t_colorspec *tc));
555 void reset_textcolor __PROTO((const struct t_colorspec *tc));
556 
557 /* Timestamp code shared by 2D and 3D */
558 void do_timelabel __PROTO((unsigned int x, unsigned int y));
559 
560 extern fill_style_type default_fillstyle;
561 
562 #ifdef EAM_OBJECTS
563 /*       Warning: C89 does not like the union initializers     */
564 extern struct object default_rectangle;
565 #define DEFAULT_RECTANGLE_STYLE { NULL, -1, 0, OBJ_RECTANGLE, OBJ_CLIP,	\
566 	{FS_SOLID, 100, 0, BLACK_COLORSPEC},   			\
567 	{0, LT_BACKGROUND, 0, DASHTYPE_SOLID, 0, 0, 1.0, 0.0, DEFAULT_P_CHAR, BACKGROUND_COLORSPEC, DEFAULT_DASHPATTERN}, \
568 	{.rectangle = {0, {0,0,0,0.,0.,0.}, {0,0,0,0.,0.,0.}, {0,0,0,0.,0.,0.}, {0,0,0,0.,0.,0.}}} }
569 
570 extern struct object default_circle;
571 #define DEFAULT_CIRCLE_STYLE { NULL, -1, 0, OBJ_CIRCLE, OBJ_CLIP, \
572 	{FS_SOLID, 100, 0, BLACK_COLORSPEC},   			\
573 	{0, LT_BACKGROUND, 0, DASHTYPE_SOLID, 0, 0, 1.0, 0.0, DEFAULT_P_CHAR, BACKGROUND_COLORSPEC, DEFAULT_DASHPATTERN}, \
574 	{.circle = {1, {0,0,0,0.,0.,0.}, {graph,0,0,0.02,0.,0.}, 0., 360., TRUE }} }
575 
576 extern struct object default_ellipse;
577 #define DEFAULT_ELLIPSE_STYLE { NULL, -1, 0, OBJ_ELLIPSE, OBJ_CLIP, \
578 	{FS_SOLID, 100, 0, BLACK_COLORSPEC},   			\
579 	{0, LT_BACKGROUND, 0, DASHTYPE_SOLID, 0, 0, 1.0, 0.0, DEFAULT_P_CHAR, BACKGROUND_COLORSPEC, DEFAULT_DASHPATTERN}, \
580 	{.ellipse = {ELLIPSEAXES_XY, {0,0,0,0.,0.,0.}, {graph,graph,0,0.05,0.03,0.}, 0. }} }
581 
582 #define DEFAULT_POLYGON_STYLE { NULL, -1, 0, OBJ_POLYGON, OBJ_CLIP, \
583 	{FS_SOLID, 100, 0, BLACK_COLORSPEC},   			\
584 	{0, LT_BLACK, 0, DASHTYPE_SOLID, 0, 0, 1.0, 0.0, DEFAULT_P_CHAR, BLACK_COLORSPEC, DEFAULT_DASHPATTERN}, \
585 	{.polygon = {0, NULL} } }
586 
587 #endif
588 
589 /* filledcurves style options set by 'set style [data|func] filledcurves opts' */
590 extern filledcurves_opts filledcurves_opts_data;
591 extern filledcurves_opts filledcurves_opts_func;
592 
593 /* Prefer line styles over plain line types */
594 #if TRUE || defined(BACKWARDS_COMPATIBLE)
595 extern TBOOLEAN prefer_line_styles;
596 #else
597 #define prefer_line_styles FALSE
598 #endif
599 
600 extern histogram_style histogram_opts;
601 
602 #ifdef EAM_BOXED_TEXT
603 extern textbox_style textbox_opts;
604 #endif
605 
606 void default_arrow_style __PROTO((struct arrow_style_type *arrow));
607 void apply_head_properties __PROTO((struct arrow_style_type *arrow_properties));
608 
609 void free_labels __PROTO((struct text_label *tl));
610 
611 void get_offsets __PROTO((struct text_label *this_label, int *htic, int *vtic));
612 void write_label __PROTO((unsigned int x, unsigned int y, struct text_label *label));
613 int label_width __PROTO((const char *, int *));
614 
615 #endif /* GNUPLOT_GADGETS_H */
616