Hi,
Attaching a patch that converts "line_width" to
PROP_STDNAME_LINE_WIDTH etc. I had started converting such constants
to macros a long time ago, this fixes some newly introduced usage of
"line_width".
On a related note, I was thinking of making DiaObject a derived class
of GObject. This will allow us to use the support provided by Glib for
properties, potentially removing a lot of _get() and _set() code from
Dia. With that, we might possibly eliminate all these constants, since
the GObject framework has some built-in checks for property names and
types.
http://library.gnome.org/devel/gobject/stable/gobject-properties.html
Sameer.
--
http://www.it.iitb.ac.in/~sameerds/
=== modified file 'objects/Database/compound.c'
--- objects/Database/compound.c 2007-10-20 15:33:20 +0000
+++ objects/Database/compound.c 2008-11-18 10:10:03 +0000
@@ -202,7 +202,7 @@
static PropOffset compound_offsets[] =
{
{ "line_colour", PROP_TYPE_COLOUR, offsetof(Compound, line_color) },
- { "line_width", PROP_TYPE_REAL, offsetof(Compound, line_width) },
+ { PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(Compound, line_width) },
{ "num_arms", PROP_TYPE_INT, offsetof(Compound, num_arms) },
{ NULL, 0, 0 }
@@ -476,7 +476,7 @@
}
/* load remainding properties */
- attr = object_find_attribute (obj_node, "line_width");
+ attr = object_find_attribute (obj_node, PROP_STDTYPE_LINE_WIDTH);
if (attr == NULL)
comp->line_width = 0.1;
else
@@ -510,7 +510,7 @@
data_add_point (attr, &h->pos);
}
- attr = new_attribute (obj_node, "line_width");
+ attr = new_attribute (obj_node, PROP_STDNAME_LINE_WIDTH);
data_add_real (attr, comp->line_width);
attr = new_attribute (obj_node, "line_color");
data_add_color (attr, &comp->line_color);
=== modified file 'objects/Database/reference.c'
--- objects/Database/reference.c 2008-11-02 18:15:10 +0000
+++ objects/Database/reference.c 2008-11-18 10:10:03 +0000
@@ -127,7 +127,7 @@
ORTHCONN_COMMON_PROPERTIES_OFFSETS,
{ "text_colour", PROP_TYPE_COLOUR, offsetof(TableReference, text_color) },
{ "line_colour", PROP_TYPE_COLOUR, offsetof(TableReference, line_color) },
- { "line_width", PROP_TYPE_REAL, offsetof(TableReference, line_width) },
+ { PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(TableReference, line_width) },
{ "line_style", PROP_TYPE_LINESTYLE, offsetof(TableReference, line_style),
offsetof(TableReference, dashlength) },
{ "end_arrow", PROP_TYPE_ARROW, offsetof(TableReference, end_arrow) },
=== modified file 'objects/Database/table.c'
--- objects/Database/table.c 2008-07-19 16:52:19 +0000
+++ objects/Database/table.c 2008-11-18 10:10:03 +0000
@@ -217,7 +217,7 @@
{ "text_colour", PROP_TYPE_COLOUR, offsetof(Table, text_color) },
{ "line_colour", PROP_TYPE_COLOUR, offsetof(Table, line_color) },
{ "fill_colour", PROP_TYPE_COLOUR, offsetof(Table, fill_color) },
- { "line_width", PROP_TYPE_REAL, offsetof(Table, border_width) },
+ { PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(Table, border_width) },
{ "name", PROP_TYPE_STRING, offsetof(Table, name) },
{ "comment", PROP_TYPE_STRING, offsetof(Table, comment) },
{ "visible_comment", PROP_TYPE_BOOL, offsetof(Table, visible_comment) },
@@ -429,7 +429,7 @@
table->text_color = attributes_get_foreground ();
if (object_find_attribute (obj_node, "fill_colour") == NULL)
table->fill_color = attributes_get_background ();
- if (object_find_attribute (obj_node, "line_width") == NULL)
+ if (object_find_attribute (obj_node, PROP_STDNAME_LINE_WIDTH) == NULL)
table->border_width = attributes_get_default_linewidth ();
if (object_find_attribute (obj_node, "underline_primary_key") == NULL)
table->underline_primary_key = TRUE;
=== modified file 'objects/UML/actor.c'
--- objects/UML/actor.c 2008-10-12 14:51:43 +0000
+++ objects/UML/actor.c 2008-11-18 10:10:03 +0000
@@ -399,7 +399,7 @@
/* For compatibility with previous dia files. If no line_width, use
* ACTOR_LINEWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((Actor*)obj)->line_width = ACTOR_LINEWIDTH;
=== modified file 'objects/UML/class.c'
--- objects/UML/class.c 2008-10-12 14:51:43 +0000
+++ objects/UML/class.c 2008-11-18 10:10:03 +0000
@@ -2092,7 +2092,7 @@
umlclass->comment_line_length);
data_add_boolean(new_attribute(obj_node, "comment_tagging"),
umlclass->comment_tagging);
- data_add_real(new_attribute(obj_node, "line_width"),
+ data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
umlclass->line_width);
data_add_color(new_attribute(obj_node, "line_color"),
¨class->line_color);
@@ -2229,7 +2229,7 @@
/* Loads the line width */
umlclass->line_width = UMLCLASS_BORDER;
- attr_node = object_find_attribute(obj_node, "line_width");
+ attr_node = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if(attr_node != NULL)
umlclass->line_width = data_real(attribute_first_data(attr_node));
=== modified file 'objects/UML/large_package.c'
--- objects/UML/large_package.c 2008-10-12 14:51:43 +0000
+++ objects/UML/large_package.c 2008-11-18 10:10:03 +0000
@@ -402,7 +402,7 @@
/* For compatibility with previous dia files. If no line_width, use
* LARGEPACKAGE_BORDERWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((LargePackage*)obj)->line_width = LARGEPACKAGE_BORDERWIDTH;
=== modified file 'objects/UML/note.c'
--- objects/UML/note.c 2008-10-12 14:51:43 +0000
+++ objects/UML/note.c 2008-11-18 10:10:03 +0000
@@ -359,7 +359,7 @@
/* For compatibility with previous dia files. If no line_width, use
* NOTE_BORDERWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((Note*)obj)->line_width = NOTE_BORDERWIDTH;
=== modified file 'objects/UML/object.c'
--- objects/UML/object.c 2008-10-12 14:51:43 +0000
+++ objects/UML/object.c 2008-11-18 10:10:03 +0000
@@ -520,7 +520,7 @@
/* For compatibility with previous dia files. If no line_width, use
* OBJET_BORDERWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((Objet*)obj)->line_width = OBJET_BORDERWIDTH;
=== modified file 'objects/UML/small_package.c'
--- objects/UML/small_package.c 2008-10-12 14:51:43 +0000
+++ objects/UML/small_package.c 2008-11-18 10:10:03 +0000
@@ -409,7 +409,7 @@
/* For compatibility with previous dia files. If no line_width, use
* SMALLPACKAGE_BORDERWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((SmallPackage*)obj)->line_width = SMALLPACKAGE_BORDERWIDTH;
=== modified file 'objects/UML/usecase.c'
--- objects/UML/usecase.c 2008-10-12 14:51:43 +0000
+++ objects/UML/usecase.c 2008-11-18 10:10:03 +0000
@@ -471,7 +471,7 @@
/* For compatibility with previous dia files. If no line_width, use
* USECASE_LINEWIDTH, that was the previous line width.
*/
- attr = object_find_attribute(obj_node, "line_width");
+ attr = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
if (attr == NULL)
((Usecase*)obj)->line_width = USECASE_LINEWIDTH;
=== modified file 'objects/custom_lines/custom_linetypes.c'
--- objects/custom_lines/custom_linetypes.c 2008-03-05 15:57:20 +0000
+++ objects/custom_lines/custom_linetypes.c 2008-11-18 10:10:03 +0000
@@ -158,7 +158,7 @@
_customline_prop_descs[] = {
{ "line_colour", PROP_TYPE_COLOUR },
{ "line_style", PROP_TYPE_LINESTYLE },
- { "line_width", PROP_TYPE_REAL },
+ { PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH },
{ "corner_radius", PROP_TYPE_REAL },
{ "start_arrow", PROP_TYPE_ARROW },
{ "end_arrow", PROP_TYPE_ARROW },
_______________________________________________
dia-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://live.gnome.org/Dia/Faq
Main page at http://live.gnome.org/Dia