adg: provide example on how to customize a style
[adg.git] / src / adg / adg-dress.c
blobc2023e78d3f52af538ddce8868fbe18c812854dd
1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2007-2017 Nicola Fontana <ntd at entidi.it>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 /**
22 * SECTION:adg-dress
23 * @Section_Id:Dresses
24 * @title: AdgDress
25 * @short_description: The ADG way to associate styles to entities
27 * The dress is a virtualization of an #AdgStyle instance. #AdgEntity
28 * objects do not directly refer to #AdgStyle but use #AdgDress values
29 * instead. This allows some advanced operations, such as overriding
30 * a dress only in a specific entity branch of the hierarchy or
31 * customize multiple entities at once.
33 * Since: 1.0
34 **/
36 /**
37 * AdgDress:
38 * @ADG_DRESS_UNDEFINED: undefined dress, used for notifying invalid
39 * dresses.
40 * @ADG_DRESS_COLOR: default built-in color. This is a
41 * pass-through dress, that is it does not
42 * change the cairo context when it is
43 * applied. This dress will be resolved to an
44 * #AdgColorStyle instance.
45 * @ADG_DRESS_COLOR_BACKGROUND: default built-in color to be used as the
46 * #AdgCanvas background. This dress will be
47 * resolved to an #AdgColorStyle instance.
48 * @ADG_DRESS_COLOR_STROKE: default built-in color for #AdgStroke
49 * entities. This dress will be resolved to
50 * an #AdgColorStyle instance.
51 * @ADG_DRESS_COLOR_DIMENSION: built-in color used by default in
52 * #AdgDimStyle. This dress will be resolved
53 * to an #AdgColorStyle instance.
54 * @ADG_DRESS_COLOR_ANNOTATION: built-in color used for rendering
55 * helper entities such as #AdgToyText,
56 * #AdgTable and #AdgTitleBlock. This dress
57 * will be resolved to an #AdgColorStyle
58 * instance.
59 * @ADG_DRESS_COLOR_FILL: built-in color used by default by
60 * #AdgFillStyle based styles. This dress
61 * will be resolved to an #AdgColorStyle
62 * instance.
63 * @ADG_DRESS_COLOR_AXIS: default built-in color for stroking
64 * #ADG_DRESS_LINE_AXIS lines. This dress
65 * will be resolved to an #AdgColorStyle
66 * instance.
67 * @ADG_DRESS_COLOR_HIDDEN: default built-in color for stroking
68 * #ADG_DRESS_LINE_HIDDEN lines. This dress
69 * will be resolved to an #AdgColorStyle
70 * instance.
71 * @ADG_DRESS_LINE: default built-in line. This is a
72 * pass-through dress, that is it does not
73 * change the cairo context when it is
74 * applied. This dress will be resolved to
75 * an #AdgLineStyle instance.
76 * @ADG_DRESS_LINE_STROKE: built-in line type to be used by default
77 * for rendering #AdgStroke entities.
78 * This dress will be resolved to an
79 * #AdgLineStyle instance.
80 * @ADG_DRESS_LINE_DIMENSION: built-in line type used by default for
81 * rendering base and extension lines of
82 * dimensions. This dress will be resolved
83 * to an #AdgLineStyle instance.
84 * @ADG_DRESS_LINE_FILL: built-in line type used by #AdgFillStyle.
85 * This dress will be resolved to an
86 * #AdgLineStyle instance.
87 * @ADG_DRESS_LINE_GRID: built-in line type used for rendering
88 * the grid of #AdgTable entities, that is
89 * the frame of the cells. This dress will
90 * be resolved to an #AdgLineStyle instance.
91 * @ADG_DRESS_LINE_FRAME: built-in line type used for rendering the
92 * frame of #AdgTable entities, that is the
93 * frame around the whole table. This dress
94 * will be resolved to an #AdgLineStyle
95 * instance.
96 * @ADG_DRESS_LINE_AXIS: built-in line type used for rendering axis
97 * and centerlines. This dress will be
98 * resolved to an #AdgLineStyle instance.
99 * @ADG_DRESS_LINE_HIDDEN: built-in line type used for rendering
100 * hidden lines and edges. This dress will be
101 * resolved to an #AdgLineStyle instance.
102 * @ADG_DRESS_FONT: default built-in font. This dress will be
103 * resolved to an #AdgFontStyle instance.
104 * @ADG_DRESS_FONT_TEXT: built-in font used by default for
105 * rendering common text such as #AdgToyText
106 * or the value of #AdgTable entities. This
107 * dress will be resolved to an #AdgFontStyle
108 * instance.
109 * @ADG_DRESS_FONT_ANNOTATION: built-in font used for rendering auxiliary
110 * text, such as the titles on #AdgTable
111 * entities. This dress will be resolved to
112 * an #AdgFontStyle instance.
113 * @ADG_DRESS_FONT_QUOTE_TEXT: built-in font used for rendering regular
114 * text on dimension entities, such as the
115 * nominal value and the notes of a quote.
116 * This dress will be resolved to an
117 * #AdgFontStyle instance.
118 * @ADG_DRESS_FONT_QUOTE_ANNOTATION: built-in font used for rendering auxiliary
119 * text on dimension entities, such as the
120 * min and max limits of a quote. This dress
121 * will be resolved to an #AdgFontStyle
122 * instance.
123 * @ADG_DRESS_DIMENSION: default built-in for dimensions. This
124 * dress will be resolved to an #AdgDimStyle
125 * instance.
126 * @ADG_DRESS_DIMENSION_ANGULAR: default built-in for angular dimensions.
127 * This dress will be resolved to an
128 * #AdgDimStyle instance.
129 * @ADG_DRESS_DIMENSION_RADIUS: default built-in for radius dimensions.
130 * This dress will be resolved to an
131 * #AdgDimStyle instance.
132 * @ADG_DRESS_DIMENSION_DIAMETER: default built-in for diameter dimensions.
133 * This dress will be resolved to an
134 * #AdgDimStyle instance.
135 * @ADG_DRESS_FILL: default built-in for filling. This is a
136 * pass-through dress, that is it does not
137 * change the cairo context when it is
138 * applied. This dress will be resolved to an
139 * #AdgFillStyle derived instance.
140 * @ADG_DRESS_FILL_HATCH: built-in dress used by default by
141 * #AdgHatch instances. This dress will be
142 * resolved to an #AdgFillStyle derived
143 * instance.
144 * @ADG_DRESS_TABLE: default built-in for tables. This dress
145 * will be resolved to an #AdgTableStyle
146 * derived instance.
148 * An index representing a virtual #AdgStyle. The ADG comes equipped
149 * with some built-in dress.
151 * Since: 1.0
155 * ADG_TYPE_DRESS:
157 * The type used to express a dress index. It is defined only for GObject
158 * internal and should not be used directly (at least, as far as I know).
160 * Since: 1.0
164 * ADG_VALUE_HOLDS_DRESS:
165 * @value: a #GValue
167 * Checks whether a #GValue is actually holding an #AdgDress value or not.
169 * Returns: <constant>TRUE</constant> is @value is holding an #AdgDress, <constant>FALSE</constant> otherwise.
171 * Since: 1.0
175 #include "adg-internal.h"
176 #include "adg-dash.h"
177 #include "adg-model.h"
178 #include "adg-trail.h"
179 #include "adg-marker.h"
180 #include "adg-arrow.h"
181 #include "adg-style.h"
182 #include "adg-color-style.h"
183 #include "adg-line-style.h"
184 #include "adg-text-internal.h"
185 #include "adg-dim-style.h"
186 #include "adg-fill-style.h"
187 #include "adg-ruled-fill.h"
188 #include "adg-table-style.h"
190 #include "adg-dress.h"
191 #include "adg-dress-private.h"
193 #define MM *2.83464566927
196 static GArray * _adg_data_array (void);
197 static void _adg_data_register (AdgDress dress,
198 AdgStyle *fallback,
199 GType ancestor_type);
200 static void _adg_data_register_builtins (void);
201 static AdgDressPrivate *_adg_data_lookup (AdgDress dress);
205 * adg_dress_from_name:
206 * @name: the name of a dress
208 * Gets the dress bound to a @name string. No warnings are raised
209 * if the dress is not found.
211 * Returns: the #AdgDress value or #ADG_DRESS_UNDEFINED if not found.
213 * Since: 1.0
215 AdgDress
216 adg_dress_from_name(const gchar *name)
218 GEnumClass *dress_class = g_type_class_ref(ADG_TYPE_DRESS);
219 GEnumValue *enum_value = g_enum_get_value_by_name(dress_class, name);
220 g_type_class_unref(dress_class);
221 return enum_value != NULL ? enum_value->value : ADG_DRESS_UNDEFINED;
225 * adg_dress_are_related:
226 * @dress1: an #AdgDress
227 * @dress2: another #AdgDress
229 * Checks whether @dress1 and @dress2 are related, that is
230 * if they have the same ancestor type as returned by
231 * adg_dress_get_ancestor_type().
233 * Returns: <constant>TRUE</constant> if the dresses are related, <constant>FALSE</constant> otherwise.
235 * Since: 1.0
237 gboolean
238 adg_dress_are_related(AdgDress dress1, AdgDress dress2)
240 GType ancestor_type1, ancestor_type2;
242 ancestor_type1 = adg_dress_get_ancestor_type(dress1);
243 if (ancestor_type1 <= 0)
244 return FALSE;
246 ancestor_type2 = adg_dress_get_ancestor_type(dress2);
247 if (ancestor_type2 <= 0)
248 return FALSE;
250 return ancestor_type1 == ancestor_type2;
254 * adg_dress_set:
255 * @dress: a pointer to an #AdgDress
256 * @src: the source dress
258 * Copies @src in @dress. This operation can be successful only if
259 * @dress is #ADG_DRESS_UNDEFINED or if it contains a dress related
260 * to @src, i.e. adg_dress_are_related() returns <constant>TRUE</constant>.
262 * Returns: <constant>TRUE</constant> on copy done, <constant>FALSE</constant> on copy failed or not needed.
264 * Since: 1.0
266 gboolean
267 adg_dress_set(AdgDress *dress, AdgDress src)
269 if (*dress == src)
270 return FALSE;
272 if (*dress != ADG_DRESS_UNDEFINED && !adg_dress_are_related(*dress, src))
273 return FALSE;
275 *dress = src;
276 return TRUE;
280 * adg_dress_get_name:
281 * @dress: an #AdgDress
283 * Gets the name associated to @dress. No warnings are raised if
284 * @dress is not found.
286 * Returns: the requested name or <constant>NULL</constant> if not found.
288 * Since: 1.0
290 const gchar *
291 adg_dress_get_name(AdgDress dress)
293 GEnumClass *dress_class = g_type_class_ref(ADG_TYPE_DRESS);
294 GEnumValue *enum_value = g_enum_get_value(dress_class, dress);
295 g_type_class_unref(dress_class);
296 return enum_value != NULL ? enum_value->value_name : NULL;
300 * adg_dress_get_ancestor_type:
301 * @dress: an #AdgDress
303 * Gets the base type that should be present in every #AdgStyle
304 * acceptable by @dress. No warnings are raised if @dress
305 * is not found.
307 * Returns: the ancestor type or 0 on errors.
309 * Since: 1.0
311 GType
312 adg_dress_get_ancestor_type(AdgDress dress)
314 AdgDressPrivate *data = _adg_data_lookup(dress);
315 return data != NULL ? data->ancestor_type : 0;
319 * adg_dress_set_fallback:
320 * @dress: an #AdgDress
321 * @fallback: (transfer full): the new fallback style
323 * Associates a new @fallback style to @dress. If the dress is
324 * not valid, a warning message is raised and the function fails.
326 * @fallback is checked for compatibily with @dress. Any dress holds
327 * an ancestor type: if this type is not found in the @fallback
328 * hierarchy, a warning message is raised and the function fails.
330 * After a succesfull call, the reference to the previous fallback
331 * (if any) is dropped while a new reference to @fallback is added.
333 * Since: 1.0
335 void
336 adg_dress_set_fallback(AdgDress dress, AdgStyle *fallback)
338 AdgDressPrivate *data = _adg_data_lookup(dress);
340 g_return_if_fail(data != NULL);
342 if (data->fallback == fallback)
343 return;
345 /* Check if the new fallback style is compatible with this dress */
346 if (fallback != NULL && !adg_dress_style_is_compatible(dress, fallback)) {
347 g_warning(_("%s: the fallback style of '%s' dress (%d) must be a '%s' derived type, but a '%s' has been provided"),
348 G_STRLOC, adg_dress_get_name(dress), dress,
349 g_type_name(data->ancestor_type),
350 g_type_name(G_TYPE_FROM_INSTANCE(fallback)));
351 return;
354 if (data->fallback != NULL)
355 g_object_unref(data->fallback);
357 data->fallback = fallback;
359 if (data->fallback != NULL)
360 g_object_ref(data->fallback);
364 * adg_dress_get_fallback:
365 * @dress: an #AdgDress
367 * Gets the fallback style associated to @dress. No warnings
368 * are raised if the dress is not found. The returned style
369 * is owned by dress and should not be freed or modified.
371 * Returns: (transfer none): the requested #AdgStyle derived instance or <constant>NULL</constant> if not set.
373 * Since: 1.0
375 AdgStyle *
376 adg_dress_get_fallback(AdgDress dress)
378 AdgDressPrivate *data = _adg_data_lookup(dress);
379 return data != NULL ? data->fallback : NULL;
383 * adg_dress_style_is_compatible:
384 * @dress: an #AdgDress
385 * @style: (transfer none): the #AdgStyle to check
387 * Checks whether @style is compatible with @dress, that is if
388 * @style has the ancestor style type (as returned by
389 * adg_dress_get_ancestor_type()) in its hierarchy.
391 * Returns: <constant>TRUE</constant> if @dress can accept @style, <constant>FALSE</constant> otherwise.
393 * Since: 1.0
395 gboolean
396 adg_dress_style_is_compatible(AdgDress dress, AdgStyle *style)
398 GType ancestor_type = adg_dress_get_ancestor_type(dress);
400 g_return_val_if_fail(ancestor_type > 0, FALSE);
401 g_return_val_if_fail(ADG_IS_STYLE(style), FALSE);
403 return G_TYPE_CHECK_INSTANCE_TYPE(style, ancestor_type);
407 static GArray *
408 _adg_data_array(void)
410 /* The following register keeps track of the metadata bound to every
411 * #AdgDress value, such as the fallback style and the ancestor type.
413 * The AdgDress value is cohincident with the index of its metadata
414 * inside this register, that is if %ADG_DRESS_COLOR_BACKGROUND is 2,
415 * array->data[2] will contain its metadata.
417 static GArray *array = NULL;
419 if (G_UNLIKELY(array == NULL)) {
420 array = g_array_new(FALSE, FALSE, sizeof(AdgDressPrivate));
421 _adg_data_register_builtins();
424 return array;
427 static void
428 _adg_data_register(AdgDress dress, AdgStyle *fallback, GType ancestor_type)
430 GArray *array = _adg_data_array();
431 AdgDressPrivate data;
433 data.fallback = fallback;
434 data.ancestor_type = ancestor_type;
436 g_array_insert_vals(array, dress, g_memdup(&data, sizeof(data)), 1);
439 static void
440 _adg_data_register_builtins(void)
442 AdgDash *dash;
443 AdgMarker *arrow1, *arrow2;
445 _adg_data_register(ADG_DRESS_UNDEFINED,
446 NULL,
447 G_TYPE_INVALID);
450 /* Predefined colors */
452 _adg_data_register(ADG_DRESS_COLOR,
453 NULL,
454 ADG_TYPE_COLOR_STYLE);
456 _adg_data_register(ADG_DRESS_COLOR_BACKGROUND,
457 g_object_new(ADG_TYPE_COLOR_STYLE,
458 "blue", 1.,
459 "green", 1.,
460 "red", 1.,
461 NULL),
462 ADG_TYPE_COLOR_STYLE);
464 _adg_data_register(ADG_DRESS_COLOR_STROKE,
465 g_object_new(ADG_TYPE_COLOR_STYLE,
466 NULL),
467 ADG_TYPE_COLOR_STYLE);
469 _adg_data_register(ADG_DRESS_COLOR_DIMENSION,
470 g_object_new(ADG_TYPE_COLOR_STYLE,
471 "red", 0.,
472 "green", 0.4,
473 "blue", 0.6,
474 NULL),
475 ADG_TYPE_COLOR_STYLE);
477 _adg_data_register(ADG_DRESS_COLOR_ANNOTATION,
478 g_object_new(ADG_TYPE_COLOR_STYLE,
479 "red", 0.4,
480 "green", 0.4,
481 "blue", 0.2,
482 NULL),
483 ADG_TYPE_COLOR_STYLE);
485 _adg_data_register(ADG_DRESS_COLOR_FILL,
486 g_object_new(ADG_TYPE_COLOR_STYLE,
487 "red", 0.25,
488 "green", 0.25,
489 "blue", 0.25,
490 NULL),
491 ADG_TYPE_COLOR_STYLE);
493 _adg_data_register(ADG_DRESS_COLOR_AXIS,
494 g_object_new(ADG_TYPE_COLOR_STYLE,
495 "red", 0.,
496 "green", 0.75,
497 "blue", 0.25,
498 NULL),
499 ADG_TYPE_COLOR_STYLE);
501 _adg_data_register(ADG_DRESS_COLOR_HIDDEN,
502 g_object_new(ADG_TYPE_COLOR_STYLE,
503 "red", 0.5,
504 "green", 0.5,
505 "blue", 0.5,
506 NULL),
507 ADG_TYPE_COLOR_STYLE);
510 /* Predefined lines */
512 _adg_data_register(ADG_DRESS_LINE,
513 NULL,
514 ADG_TYPE_LINE_STYLE);
516 _adg_data_register(ADG_DRESS_LINE_STROKE,
517 g_object_new(ADG_TYPE_LINE_STYLE,
518 "color-dress", ADG_DRESS_COLOR_STROKE,
519 "width", 1.5,
520 NULL),
521 ADG_TYPE_LINE_STYLE);
523 _adg_data_register(ADG_DRESS_LINE_DIMENSION,
524 g_object_new(ADG_TYPE_LINE_STYLE,
525 "width", 0.5,
526 NULL),
527 ADG_TYPE_LINE_STYLE);
529 _adg_data_register(ADG_DRESS_LINE_FILL,
530 g_object_new(ADG_TYPE_LINE_STYLE,
531 "color-dress", ADG_DRESS_COLOR_FILL,
532 "width", 0.5,
533 NULL),
534 ADG_TYPE_LINE_STYLE);
536 _adg_data_register(ADG_DRESS_LINE_GRID,
537 g_object_new(ADG_TYPE_LINE_STYLE,
538 "antialias", CAIRO_ANTIALIAS_NONE,
539 "width", 1.,
540 NULL),
541 ADG_TYPE_LINE_STYLE);
543 _adg_data_register(ADG_DRESS_LINE_FRAME,
544 g_object_new(ADG_TYPE_LINE_STYLE,
545 "color-dress", ADG_DRESS_COLOR_ANNOTATION,
546 "antialias", CAIRO_ANTIALIAS_NONE,
547 "width", 2.,
548 NULL),
549 ADG_TYPE_LINE_STYLE);
552 dash = adg_dash_new_with_dashes(4, 2 MM, 2 MM, 10 MM, 2 MM);
553 _adg_data_register(ADG_DRESS_LINE_AXIS,
554 g_object_new(ADG_TYPE_LINE_STYLE,
555 "color-dress", ADG_DRESS_COLOR_AXIS,
556 "width", 0.25 MM,
557 "dash", dash,
558 NULL),
559 ADG_TYPE_LINE_STYLE);
560 adg_dash_destroy(dash);
562 dash = adg_dash_new_with_dashes(2, 6 MM, 6 MM);
563 _adg_data_register(ADG_DRESS_LINE_HIDDEN,
564 g_object_new(ADG_TYPE_LINE_STYLE,
565 "color-dress", ADG_DRESS_COLOR_HIDDEN,
566 "width", 0.25 MM,
567 "dash", dash,
568 NULL),
569 ADG_TYPE_LINE_STYLE);
570 adg_dash_destroy(dash);
573 /* Predefined fonts */
575 _adg_data_register(ADG_DRESS_FONT,
576 g_object_new(ADG_TYPE_BEST_FONT_STYLE,
577 "family", "Serif",
578 "size", 14.,
579 NULL),
580 ADG_TYPE_BEST_FONT_STYLE);
582 _adg_data_register(ADG_DRESS_FONT_TEXT,
583 g_object_new(ADG_TYPE_BEST_FONT_STYLE,
584 "color-dress", ADG_DRESS_COLOR_ANNOTATION,
585 "family", "Sans",
586 "weight", CAIRO_FONT_WEIGHT_BOLD,
587 "size", 12.,
588 NULL),
589 ADG_TYPE_BEST_FONT_STYLE);
591 _adg_data_register(ADG_DRESS_FONT_ANNOTATION,
592 g_object_new(ADG_TYPE_BEST_FONT_STYLE,
593 "color-dress", ADG_DRESS_COLOR_ANNOTATION,
594 "family", "Sans",
595 "size", 8.,
596 NULL),
597 ADG_TYPE_BEST_FONT_STYLE);
599 _adg_data_register(ADG_DRESS_FONT_QUOTE_TEXT,
600 g_object_new(ADG_TYPE_BEST_FONT_STYLE,
601 "family", "Sans",
602 "weight", CAIRO_FONT_WEIGHT_BOLD,
603 "size", 12.,
604 NULL),
605 ADG_TYPE_BEST_FONT_STYLE);
607 _adg_data_register(ADG_DRESS_FONT_QUOTE_ANNOTATION,
608 g_object_new(ADG_TYPE_BEST_FONT_STYLE,
609 "family", "Sans",
610 "size", 8.,
611 NULL),
612 ADG_TYPE_BEST_FONT_STYLE);
615 /* Predefined dimension styles */
617 arrow1 = (AdgMarker *) adg_arrow_new();
618 arrow2 = (AdgMarker *) adg_arrow_new();
619 adg_marker_set_pos(arrow2, 1);
620 _adg_data_register(ADG_DRESS_DIMENSION,
621 g_object_new(ADG_TYPE_DIM_STYLE,
622 "marker1", arrow1,
623 "marker2", arrow2,
624 NULL),
625 ADG_TYPE_DIM_STYLE);
626 g_object_unref(arrow1);
627 g_object_unref(arrow2);
630 /* Predefined angular dimension styles */
632 arrow1 = (AdgMarker *) adg_arrow_new();
633 arrow2 = (AdgMarker *) adg_arrow_new();
634 adg_marker_set_pos(arrow2, 1);
635 _adg_data_register(ADG_DRESS_DIMENSION_ANGULAR,
636 g_object_new(ADG_TYPE_DIM_STYLE,
637 "marker1", arrow1,
638 "marker2", arrow2,
639 "decimals", 0,
640 "rounding", 3,
641 "number-arguments", "Dm",
642 "number-format", "%g°(%g')",
643 NULL),
644 ADG_TYPE_DIM_STYLE);
645 g_object_unref(arrow1);
646 g_object_unref(arrow2);
649 /* Predefined radius dimension styles */
651 arrow1 = (AdgMarker *) adg_arrow_new();
652 arrow2 = (AdgMarker *) adg_arrow_new();
653 adg_marker_set_pos(arrow2, 1);
654 _adg_data_register(ADG_DRESS_DIMENSION_RADIUS,
655 g_object_new(ADG_TYPE_DIM_STYLE,
656 "marker1", arrow1,
657 "marker2", arrow2,
658 "number-arguments", "d",
659 "number-format", "R%g",
660 NULL),
661 ADG_TYPE_DIM_STYLE);
662 g_object_unref(arrow1);
663 g_object_unref(arrow2);
666 /* Predefined diameter dimension styles */
668 arrow1 = (AdgMarker *) adg_arrow_new();
669 arrow2 = (AdgMarker *) adg_arrow_new();
670 adg_marker_set_pos(arrow2, 1);
671 _adg_data_register(ADG_DRESS_DIMENSION_DIAMETER,
672 g_object_new(ADG_TYPE_DIM_STYLE,
673 "marker1", arrow1,
674 "marker2", arrow2,
675 "number-arguments", "d",
676 "number-format", ADG_UTF8_DIAMETER "%g",
677 NULL),
678 ADG_TYPE_DIM_STYLE);
679 g_object_unref(arrow1);
680 g_object_unref(arrow2);
683 /* Predefined fill styles */
685 _adg_data_register(ADG_DRESS_FILL,
686 NULL,
687 ADG_TYPE_FILL_STYLE);
689 _adg_data_register(ADG_DRESS_FILL_HATCH,
690 g_object_new(ADG_TYPE_RULED_FILL,
691 "line-dress", ADG_DRESS_LINE_FILL,
692 NULL),
693 ADG_TYPE_FILL_STYLE);
696 /* Predefined table styles */
698 _adg_data_register(ADG_DRESS_TABLE,
699 g_object_new(ADG_TYPE_TABLE_STYLE, NULL),
700 ADG_TYPE_TABLE_STYLE);
703 static AdgDressPrivate *
704 _adg_data_lookup(AdgDress dress)
706 GArray *array = _adg_data_array();
708 if (dress >= array->len)
709 return NULL;
711 return ((AdgDressPrivate *) array->data) + dress;