1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2007,2008,2009 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.
23 * @short_description: Root abstract class for all dimension entities
25 * The #AdgDim class is the base stub of all the dimension entities.
31 * All fields are private and should not be used directly.
32 * Use its public methods instead.
37 #include "adg-dim-private.h"
38 #include "adg-dim-style.h"
39 #include "adg-toy-text.h"
40 #include "adg-type-builtins.h"
43 #define PARENT_OBJECT_CLASS ((GObjectClass *) adg_dim_parent_class)
44 #define PARENT_ENTITY_CLASS ((AdgEntityClass *) adg_dim_parent_class)
62 static void dispose (GObject
*object
);
63 static void finalize (GObject
*object
);
64 static void get_property (GObject
*object
,
68 static void set_property (GObject
*object
,
72 static void global_changed (AdgEntity
*entity
);
73 static void local_changed (AdgEntity
*entity
);
74 static void invalidate (AdgEntity
*entity
);
75 static void arrange (AdgEntity
*entity
);
76 static gchar
* default_value (AdgDim
*dim
);
77 static gdouble
quote_angle (gdouble angle
);
78 static gboolean
set_dress (AdgDim
*dim
,
80 static gboolean
set_value (AdgDim
*dim
,
82 static gboolean
set_min (AdgDim
*dim
,
84 static gboolean
set_max (AdgDim
*dim
,
88 G_DEFINE_ABSTRACT_TYPE(AdgDim
, adg_dim
, ADG_TYPE_ENTITY
);
92 adg_dim_class_init(AdgDimClass
*klass
)
94 GObjectClass
*gobject_class
;
95 AdgEntityClass
*entity_class
;
98 gobject_class
= (GObjectClass
*) klass
;
99 entity_class
= (AdgEntityClass
*) klass
;
101 g_type_class_add_private(klass
, sizeof(AdgDimPrivate
));
103 gobject_class
->dispose
= dispose
;
104 gobject_class
->finalize
= finalize
;
105 gobject_class
->get_property
= get_property
;
106 gobject_class
->set_property
= set_property
;
108 entity_class
->global_changed
= global_changed
;
109 entity_class
->local_changed
= local_changed
;
110 entity_class
->invalidate
= invalidate
;
111 entity_class
->arrange
= arrange
;
113 klass
->quote_angle
= quote_angle
;
114 klass
->default_value
= default_value
;
116 param
= adg_param_spec_dress("dress",
118 P_("The dress to use for rendering this dimension"),
119 ADG_DRESS_DIMENSION_REGULAR
,
121 g_object_class_install_property(gobject_class
, PROP_DRESS
, param
);
123 param
= g_param_spec_boxed("ref1",
125 P_("First reference point of the dimension"),
127 G_PARAM_READWRITE
| G_PARAM_CONSTRUCT
);
128 g_object_class_install_property(gobject_class
, PROP_REF1
, param
);
130 param
= g_param_spec_boxed("ref2",
132 P_("Second reference point of the dimension"),
134 G_PARAM_READWRITE
| G_PARAM_CONSTRUCT
);
135 g_object_class_install_property(gobject_class
, PROP_REF2
, param
);
137 param
= g_param_spec_boxed("pos1",
139 P_("First position point: it will be computed with the level property to get the real dimension position"),
140 ADG_TYPE_PAIR
, G_PARAM_READWRITE
);
141 g_object_class_install_property(gobject_class
, PROP_POS1
, param
);
143 param
= g_param_spec_boxed("pos2",
145 P_("Second position point: it will be computed with the level property to get the real dimension position"),
146 ADG_TYPE_PAIR
, G_PARAM_READWRITE
);
147 g_object_class_install_property(gobject_class
, PROP_POS2
, param
);
149 param
= g_param_spec_double("level",
151 P_("The dimension level, that is the factor to multiply dim_style->baseline_spacing to get the offset (in device units) from pos1..pos2 where render the dimension baseline"),
152 -G_MAXDOUBLE
, G_MAXDOUBLE
, 1.0,
154 g_object_class_install_property(gobject_class
, PROP_LEVEL
, param
);
156 param
= g_param_spec_enum("outside",
158 P_("Whether the arrows must be inside the extension lines (ADG_THREE_STATE_OFF), must be extended outside the extension lines (ADG_THREE_STATE_ON) or should be automatically handled depending on the available space"),
159 ADG_TYPE_THREE_STATE
, ADG_THREE_STATE_UNKNOWN
,
161 g_object_class_install_property(gobject_class
, PROP_OUTSIDE
, param
);
163 param
= g_param_spec_string("value",
165 P_("The theoretically exact value for this quote: set to NULL to automatically get the default value"),
166 NULL
, G_PARAM_READWRITE
);
167 g_object_class_install_property(gobject_class
, PROP_VALUE
, param
);
169 param
= g_param_spec_string("value-min",
170 P_("Minimum Value or Low Tolerance"),
171 P_("The minimum value allowed or the lowest tolerance from value (depending of the dimension style): set to NULL to suppress"),
172 NULL
, G_PARAM_READWRITE
);
173 g_object_class_install_property(gobject_class
, PROP_MIN
, param
);
175 param
= g_param_spec_string("value-max",
176 P_("Maximum Value or High Tolerance"),
177 P_("The maximum value allowed or the highest tolerance from value (depending of the dimension style): set to NULL to suppress"),
178 NULL
, G_PARAM_READWRITE
);
179 g_object_class_install_property(gobject_class
, PROP_MAX
, param
);
183 adg_dim_init(AdgDim
*dim
)
185 AdgDimPrivate
*data
= G_TYPE_INSTANCE_GET_PRIVATE(dim
, ADG_TYPE_DIM
,
188 data
->dress
= ADG_DRESS_DIMENSION_REGULAR
;
189 data
->ref1
.x
= data
->ref1
.y
= 0;
190 data
->ref2
.x
= data
->ref2
.y
= 0;
191 data
->pos1
.x
= data
->pos1
.y
= 0;
192 data
->pos2
.x
= data
->pos2
.y
= 0;
194 data
->outside
= ADG_THREE_STATE_UNKNOWN
;
203 dispose(GObject
*object
)
205 AdgDimPrivate
*data
= ((AdgDim
*) object
)->data
;
207 if (data
->quote
.container
!= NULL
) {
208 g_object_unref(data
->quote
.container
);
209 data
->quote
.container
= NULL
;
212 if (PARENT_OBJECT_CLASS
->dispose
!= NULL
)
213 PARENT_OBJECT_CLASS
->dispose(object
);
217 finalize(GObject
*object
)
219 AdgDimPrivate
*data
= ((AdgDim
*) object
)->data
;
225 if (PARENT_OBJECT_CLASS
->finalize
!= NULL
)
226 PARENT_OBJECT_CLASS
->finalize(object
);
230 get_property(GObject
*object
, guint prop_id
, GValue
*value
, GParamSpec
*pspec
)
232 AdgDimPrivate
*data
= ((AdgDim
*) object
)->data
;
236 g_value_set_int(value
, data
->dress
);
239 g_value_set_boxed(value
, &data
->ref1
);
242 g_value_set_boxed(value
, &data
->ref2
);
245 g_value_set_boxed(value
, &data
->pos1
);
248 g_value_set_boxed(value
, &data
->pos1
);
251 g_value_set_double(value
, data
->level
);
254 g_value_set_enum(value
, data
->outside
);
257 g_value_set_string(value
, data
->value
);
260 g_value_set_string(value
, data
->min
);
263 g_value_set_string(value
, data
->max
);
266 G_OBJECT_WARN_INVALID_PROPERTY_ID(object
, prop_id
, pspec
);
272 set_property(GObject
*object
, guint prop_id
,
273 const GValue
*value
, GParamSpec
*pspec
)
278 dim
= (AdgDim
*) object
;
283 set_dress(dim
, g_value_get_int(value
));
286 cpml_pair_copy(&data
->ref1
, (AdgPair
*) g_value_get_boxed(value
));
289 cpml_pair_copy(&data
->ref2
, (AdgPair
*) g_value_get_boxed(value
));
292 cpml_pair_copy(&data
->pos1
, (AdgPair
*) g_value_get_boxed(value
));
295 cpml_pair_copy(&data
->pos2
, (AdgPair
*) g_value_get_boxed(value
));
298 data
->level
= g_value_get_double(value
);
301 data
->outside
= g_value_get_enum(value
);
304 set_value(dim
, g_value_get_string(value
));
307 set_min(dim
, g_value_get_string(value
));
310 set_max(dim
, g_value_get_string(value
));
313 G_OBJECT_WARN_INVALID_PROPERTY_ID(object
, prop_id
, pspec
);
323 * Gets the dimension dress to be used in rendering @dim.
325 * Returns: the current dimension dress
328 adg_dim_get_dress(AdgDim
*dim
)
332 g_return_val_if_fail(ADG_IS_DIM(dim
), ADG_DRESS_UNDEFINED
);
342 * @dress: the new #AdgDress to use
344 * Sets a new dimension dress to @dim. The new dress must be
345 * related to the original dress for this property: you cannot
346 * set a dress used for line styles to a dress managing fonts.
348 * The check is done by calling adg_dress_are_related() with
349 * @dress and the previous dress as arguments. Check out its
350 * documentation for details on what is a related dress.
353 adg_dim_set_dress(AdgDim
*dim
, AdgDress dress
)
355 g_return_if_fail(ADG_IS_DIM(dim
));
357 if (set_dress(dim
, dress
))
358 g_object_notify((GObject
*) dim
, "dress");
365 * Gets the ref1 coordinates. The returned pair is internally owned
366 * and must not be freed or modified.
368 * Returns: the ref1 coordinates
371 adg_dim_get_ref1(AdgDim
*dim
)
375 g_return_val_if_fail(ADG_IS_DIM(dim
), NULL
);
386 * Gets the ref2 coordinates. The returned pair is internally owned
387 * and must not be freed or modified.
389 * Returns: the ref2 coordinates
392 adg_dim_get_ref2(AdgDim
*dim
)
396 g_return_val_if_fail(ADG_IS_DIM(dim
), NULL
);
406 * @ref1: the ref1 coordinates
407 * @ref2: the ref2 coordinates
409 * Shortcut to set ref1 and ref2 points at once.
412 adg_dim_set_ref(AdgDim
*dim
, const AdgPair
*ref1
, const AdgPair
*ref2
)
414 g_return_if_fail(ADG_IS_DIM(dim
));
416 if (ref1
!= NULL
|| ref2
!= NULL
) {
421 object
= (GObject
*) dim
;
423 g_object_freeze_notify(object
);
427 g_object_notify(object
, "ref1");
432 g_object_notify(object
, "ref2");
435 g_object_thaw_notify(object
);
440 * adg_dim_set_ref_explicit:
442 * @ref1_x: x component of pos1
443 * @ref1_y: y component of pos1
444 * @ref2_x: x component of pos2
445 * @ref2_y: y component of pos2
447 * Shortcut to set ref1 and ref2 points at once,
448 * using explicit coordinates.
451 adg_dim_set_ref_explicit(AdgDim
*dim
, gdouble ref1_x
, gdouble ref1_y
,
452 gdouble ref2_x
, gdouble ref2_y
)
462 adg_dim_set_ref(dim
, &ref1
, &ref2
);
469 * Gets the pos1 coordinates. The returned pair is internally owned
470 * and must not be freed or modified.
472 * Returns: the pos1 coordinates
475 adg_dim_get_pos1(AdgDim
*dim
)
479 g_return_val_if_fail(ADG_IS_DIM(dim
), NULL
);
490 * Gets the pos2 coordinates. The returned pair is internally owned
491 * and must not be freed or modified.
493 * Returns: the pos2 coordinates
496 adg_dim_get_pos2(AdgDim
*dim
)
500 g_return_val_if_fail(ADG_IS_DIM(dim
), NULL
);
510 * @pos1: the pos1 coordinates
511 * @pos2: the pos2 coordinates
513 * Shortcut to set pos1 and pos2 points at once.
516 adg_dim_set_pos(AdgDim
*dim
, AdgPair
*pos1
, AdgPair
*pos2
)
518 g_return_if_fail(ADG_IS_DIM(dim
));
520 if (pos1
!= NULL
|| pos2
!= NULL
) {
525 object
= (GObject
*) dim
;
527 g_object_freeze_notify(object
);
531 g_object_notify(object
, "pos1");
535 g_object_notify(object
, "pos2");
538 g_object_thaw_notify(object
);
543 * adg_dim_set_pos_explicit:
545 * @pos1_x: x component of pos1
546 * @pos1_y: y component of pos1
547 * @pos2_x: x component of pos2
548 * @pos2_y: y component of pos2
550 * Shortcut to set pos1 and pos2 points at once,
551 * using explicit coordinates.
554 adg_dim_set_pos_explicit(AdgDim
*dim
, gdouble pos1_x
, gdouble pos1_y
,
555 gdouble pos2_x
, gdouble pos2_y
)
565 adg_dim_set_pos(dim
, &pos1
, &pos2
);
572 * Gets the level of this dimension.
574 * Returns: the level value
577 adg_dim_get_level(AdgDim
*dim
)
581 g_return_val_if_fail(ADG_IS_DIM(dim
), 0);
591 * @level: the new level
593 * Sets a new level for this dimension. The level is used to
594 * stack the quotes using a spacing value from dim_style
595 * (specified in global space).
598 adg_dim_set_level(AdgDim
*dim
, gdouble level
)
602 g_return_if_fail(ADG_IS_DIM(dim
));
607 g_object_notify((GObject
*) dim
, "level");
611 * adg_dim_get_outside:
614 * Gets the state of the #AdgDim:outside property: check the property
615 * documentation for further details.
617 * Returns: the current flag state
620 adg_dim_get_outside(AdgDim
*dim
)
624 g_return_val_if_fail(ADG_IS_DIM(dim
), ADG_THREE_STATE_UNKNOWN
);
628 return data
->outside
;
632 * adg_dim_set_outside:
634 * @outside: the new outside state
636 * Sets a new state for the #AdgDim:outside flag: check the property
637 * documentation for further details.
640 adg_dim_set_outside(AdgDim
*dim
, AdgThreeState outside
)
644 g_return_if_fail(ADG_IS_DIM(dim
));
647 data
->outside
= outside
;
649 g_object_notify((GObject
*) dim
, "outside");
656 * Gets the value text. The string is internally owned and
657 * must not be freed or modified.
659 * Returns: the value text
662 adg_dim_get_value(AdgDim
*dim
)
666 g_return_val_if_fail(ADG_IS_DIM(dim
), NULL
);
676 * @value: the value text
678 * Explicitely sets the text to use as value. If @value is %NULL or
679 * was never set, an automatic text is calculated using the format
680 * specified in the current #AdgDimStyle and getting its value by
681 * calling the default_value() virtual method.
684 adg_dim_set_value(AdgDim
*dim
, const gchar
*value
)
686 g_return_if_fail(ADG_IS_DIM(dim
));
688 if (set_value(dim
, value
))
689 g_object_notify((GObject
*) dim
, "value");
696 * Gets the minimum value text or %NULL on minimum value disabled.
697 * The string is internally owned and must not be freed or modified.
699 * Returns: the mimimum value text
702 adg_dim_get_min(AdgDim
*dim
)
706 g_return_val_if_fail(ADG_IS_DIM(dim
), NULL
);
716 * @min: the new minimum limit
718 * Sets the minimum value. Use %NULL as @min to disable it.
721 adg_dim_set_min(AdgDim
*dim
, const gchar
*min
)
723 g_return_if_fail(ADG_IS_DIM(dim
));
725 if (set_min(dim
, min
))
726 g_object_notify((GObject
*) dim
, "value-min");
733 * Gets the maximum value text or %NULL on maximum value disabled.
734 * The string is internally owned and must not be freed or modified.
736 * Returns: the maximum value text
739 adg_dim_get_max(AdgDim
*dim
)
743 g_return_val_if_fail(ADG_IS_DIM(dim
), NULL
);
753 * @max: the new maximum value
755 * Sets the maximum value. Use %NULL as @max to disable it.
758 adg_dim_set_max(AdgDim
*dim
, const gchar
*max
)
760 g_return_if_fail(ADG_IS_DIM(dim
));
762 if (set_max(dim
, max
))
763 g_object_notify((GObject
*) dim
, "value-max");
767 * adg_dim_set_limits:
769 * @min: the new minumum value
770 * @max: the new maximum value
772 * Shortcut to set both the limits at once.
775 adg_dim_set_limits(AdgDim
*dim
, const gchar
*min
, const gchar
*max
)
777 g_return_if_fail(ADG_IS_DIM(dim
));
779 g_object_freeze_notify((GObject
*) dim
);
780 adg_dim_set_min(dim
, min
);
781 adg_dim_set_max(dim
, max
);
782 g_object_thaw_notify((GObject
*) dim
);
786 * adg_dim_get_dim_style:
787 * @dim: an #AdgDim entity
789 * Gets the #AdgDimStyle associated to @dim. The dress to style
790 * resolution is done in the arrange() method so this value is
791 * typically available in render() or in a derived arrange()
792 * method, after the #AdgDim arrange() function has been chained up.
794 * Returns: the dim style of @entity
797 adg_dim_get_dim_style(AdgDim
*dim
)
801 g_return_val_if_fail(ADG_IS_DIM(dim
), NULL
);
805 return data
->dim_style
;
813 * This function is only useful in new dimension implementations.
816 * Gets the quote container, if any. This function is valid only
817 * after the #AdgDim implementation of the arrange() virtual method
820 * Returns: the quote container
823 adg_dim_get_quote(AdgDim
*dim
)
827 g_return_val_if_fail(ADG_IS_DIM(dim
), NULL
);
831 return data
->quote
.container
;
835 * adg_dim_quote_angle:
837 * @angle: an angle (in radians)
840 * This function is only useful in new dimension implementations.
843 * Converts @angle accordling to the style of @dim. Any quote angle
844 * should be validated by this method because every dimensioning
845 * style has its own convention regardling the text rotation.
847 * Returns: the angle to use (always in radians)
850 adg_dim_quote_angle(AdgDim
*dim
, gdouble angle
)
854 g_return_val_if_fail(ADG_IS_DIM(dim
), angle
);
856 klass
= ADG_DIM_GET_CLASS(dim
);
858 if (klass
->quote_angle
== NULL
)
861 return klass
->quote_angle(angle
);
865 arrange(AdgEntity
*entity
)
869 AdgEntity
*container_entity
;
870 AdgEntity
*value_entity
;
871 AdgEntity
*min_entity
;
872 AdgEntity
*max_entity
;
875 const AdgPair
*shift
;
877 dim
= (AdgDim
*) entity
;
880 /* Resolve the dim style */
881 if (data
->dim_style
== NULL
)
882 data
->dim_style
= (AdgDimStyle
*) adg_entity_style(entity
, data
->dress
);
884 if (data
->quote
.container
== NULL
)
885 data
->quote
.container
= g_object_new(ADG_TYPE_CONTAINER
,
886 "parent", dim
, NULL
);
888 if (data
->quote
.value
== NULL
) {
889 AdgDress dress
= adg_dim_style_get_value_dress(data
->dim_style
);
891 data
->quote
.value
= g_object_new(ADG_TYPE_TOY_TEXT
,
892 "dress", dress
, NULL
);
894 adg_container_add(data
->quote
.container
,
895 (AdgEntity
*) data
->quote
.value
);
897 if (data
->value
== NULL
) {
898 /* Automatically generate the value text */
899 gchar
*text
= ADG_DIM_GET_CLASS(dim
)->default_value(dim
);
900 adg_toy_text_set_label(data
->quote
.value
, text
);
903 adg_toy_text_set_label(data
->quote
.value
, data
->value
);
907 if (data
->quote
.min
== NULL
&& data
->min
!= NULL
) {
908 AdgDress dress
= adg_dim_style_get_min_dress(data
->dim_style
);
910 data
->quote
.min
= g_object_new(ADG_TYPE_TOY_TEXT
, "dress", dress
, NULL
);
912 adg_container_add(data
->quote
.container
, (AdgEntity
*) data
->quote
.min
);
913 adg_toy_text_set_label(data
->quote
.min
, data
->min
);
916 if (data
->quote
.max
== NULL
&& data
->max
!= NULL
) {
917 AdgDress dress
= adg_dim_style_get_max_dress(data
->dim_style
);
919 data
->quote
.max
= g_object_new(ADG_TYPE_TOY_TEXT
, "dress", dress
, NULL
);
921 adg_container_add(data
->quote
.container
, (AdgEntity
*) data
->quote
.max
);
922 adg_toy_text_set_label(data
->quote
.max
, data
->max
);
925 container_entity
= (AdgEntity
*) data
->quote
.container
;
926 value_entity
= (AdgEntity
*) data
->quote
.value
;
927 min_entity
= (AdgEntity
*) data
->quote
.min
;
928 max_entity
= (AdgEntity
*) data
->quote
.max
;
931 adg_entity_get_extents(value_entity
, &extents
);
933 /* Limit values (min and max) */
934 if (min_entity
!= NULL
|| max_entity
!= NULL
) {
935 CpmlExtents min_extents
= { 0 };
936 CpmlExtents max_extents
= { 0 };
940 if (min_entity
!= NULL
)
941 adg_entity_get_extents(min_entity
, &min_extents
);
944 if (max_entity
!= NULL
)
945 adg_entity_get_extents(max_entity
, &max_extents
);
947 shift
= adg_dim_style_get_limits_shift(data
->dim_style
);
948 if (min_entity
!= NULL
&& max_entity
!= NULL
)
949 spacing
= adg_dim_style_get_limits_spacing(data
->dim_style
);
951 cairo_matrix_init_translate(&map
, extents
.size
.x
+ shift
->x
,
952 (spacing
+ min_extents
.size
.y
+
953 max_extents
.size
.y
) / 2 +
954 shift
->y
- extents
.size
.y
/ 2);
956 if (min_entity
!= NULL
)
957 adg_entity_set_global_map(min_entity
, &map
);
959 if (max_entity
!= NULL
) {
960 cairo_matrix_translate(&map
, 0, -min_extents
.size
.y
- spacing
);
961 adg_entity_set_global_map(max_entity
, &map
);
964 extents
.size
.x
+= shift
->x
+ MAX(min_extents
.size
.x
, max_extents
.size
.x
);
967 /* Center and apply the style displacements */
968 shift
= adg_dim_style_get_quote_shift(data
->dim_style
);
969 cairo_matrix_init_translate(&map
, shift
->x
- extents
.size
.x
/ 2, shift
->y
);
970 adg_entity_set_global_map(container_entity
, &map
);
972 adg_entity_arrange(container_entity
);
977 global_changed(AdgEntity
*entity
)
979 AdgDimPrivate
*data
= ((AdgDim
*) entity
)->data
;
981 PARENT_ENTITY_CLASS
->global_changed(entity
);
983 if (data
->quote
.container
!= NULL
)
984 adg_entity_global_changed((AdgEntity
*) data
->quote
.container
);
988 local_changed(AdgEntity
*entity
)
990 AdgDimPrivate
*data
= ((AdgDim
*) entity
)->data
;
992 PARENT_ENTITY_CLASS
->local_changed(entity
);
994 if (data
->quote
.container
!= NULL
)
995 adg_entity_local_changed((AdgEntity
*) data
->quote
.container
);
999 invalidate(AdgEntity
*entity
)
1001 AdgDimPrivate
*data
= ((AdgDim
*) entity
)->data
;
1003 if (data
->quote
.container
!= NULL
)
1004 adg_entity_invalidate((AdgEntity
*) data
->quote
.container
);
1008 default_value(AdgDim
*dim
)
1010 g_warning("AdgDim::default_value not implemented for `%s'",
1011 g_type_name(G_TYPE_FROM_INSTANCE(dim
)));
1012 return g_strdup("undef");
1016 quote_angle(gdouble angle
)
1018 angle
= cpml_angle(angle
);
1020 if (angle
> G_PI_4
|| angle
<= -G_PI_4
* 3)
1021 angle
= cpml_angle(angle
+ G_PI
);
1027 set_dress(AdgDim
*dim
, AdgDress dress
)
1029 AdgDimPrivate
*data
= dim
->data
;
1031 if (adg_dress_set(&data
->dress
, dress
)) {
1032 data
->dim_style
= NULL
;
1040 set_value(AdgDim
*dim
, const gchar
*value
)
1042 AdgDimPrivate
*data
;
1046 if (adg_strcmp(value
, data
->value
) == 0)
1049 g_free(data
->value
);
1050 data
->value
= g_strdup(value
);
1052 if (data
->quote
.value
!= NULL
) {
1053 g_object_unref(data
->quote
.value
);
1054 data
->quote
.value
= NULL
;
1061 set_min(AdgDim
*dim
, const gchar
*min
)
1063 AdgDimPrivate
*data
= dim
->data
;
1065 if (adg_strcmp(min
, data
->min
) == 0)
1069 data
->min
= g_strdup(min
);
1071 if (data
->quote
.min
!= NULL
) {
1072 g_object_unref(data
->quote
.min
);
1073 data
->quote
.min
= NULL
;
1080 set_max(AdgDim
*dim
, const gchar
*max
)
1082 AdgDimPrivate
*data
= dim
->data
;
1084 if (adg_strcmp(max
, data
->max
) == 0)
1088 data
->max
= g_strdup(max
);
1090 if (data
->quote
.max
!= NULL
) {
1091 g_object_unref(data
->quote
.max
);
1092 data
->quote
.max
= NULL
;