summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 42a42d6)
raw | patch | inline | side by side (parent: 42a42d6)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Mon, 12 Mar 2007 03:26:58 +0000 (03:26 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Mon, 12 Mar 2007 03:26:58 +0000 (03:26 +0000) |
src/sp-item.cpp | patch | blob | history | |
src/sp-object.cpp | patch | blob | history |
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 486e00d16bac19405905ed8dc862169d02a95d31..90781d37b4af460f48e58f8348b229808669dd4a 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
sigc::slot2<void,SPObject*, SPObject *> sl2=sigc::bind(sigc::ptr_fun(mask_ref_changed), this);
_mask_ref_connection = cs2.connect(sl2);
- if (!this->style) this->style = sp_style_new_from_object(this);
-
this->avoidRef = new SPAvoidRef(this);
new (&this->_transformed_signal) sigc::signal<void, NR::Matrix const *, SPItem *>();
nr_arena_item_set_sensitive(v->arenaitem, item->sensitive);
}
break;
- case SP_ATTR_STYLE:
- sp_style_read_from_object(object->style, object);
- object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
- break;
case SP_ATTR_CONNECTOR_AVOID:
item->avoidRef->setAvoid(value);
break;
repr->setAttribute("transform", c);
g_free(c);
- SPStyle const *const obj_style = SP_OBJECT_STYLE(object);
- if (obj_style) {
- gchar *s = sp_style_write_string(obj_style, SP_STYLE_FLAG_IFSET);
- repr->setAttribute("style", ( *s ? s : NULL ));
- g_free(s);
- } else {
- /** \todo I'm not sure what to do in this case. Bug #1165868
- * suggests that it can arise, but the submitter doesn't know
- * how to do so reliably. The main two options are either
- * leave repr's style attribute unchanged, or explicitly clear it.
- * Must also consider what to do with property attributes for
- * the element; see below.
- */
- char const *style_str = repr->attribute("style");
- if (!style_str) {
- style_str = "NULL";
- }
- g_warning("Item's style is NULL; repr style attribute is %s", style_str);
- }
-
- /** \note We treat object->style as authoritative. Its effects have
- * been written to the style attribute above; any properties that are
- * unset we take to be deliberately unset (e.g. so that clones can
- * override the property).
- *
- * Note that the below has an undesirable consequence of changing the
- * appearance on renderers that lack CSS support (e.g. SVG tiny);
- * possibly we should write property attributes instead of a style
- * attribute.
- */
- sp_style_unset_property_attrs (object);
-
if (flags & SP_OBJECT_WRITE_EXT) {
repr->setAttribute("sodipodi:insensitive", ( item->sensitive ? NULL : "true" ));
if (item->transform_center_x != 0)
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 9b6c249172b18839ebd50548171d2c55132f08a4..b97aa4513abecefe7f7171c4a9c98cc62313434f 100644 (file)
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
object->parent = object->next = NULL;
object->repr = NULL;
object->id = NULL;
- object->style = NULL;
+
+ object->style = sp_style_new_from_object(object);
object->_collection_policy = SPObject::COLLECT_WITH_PARENT;
}
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
break;
+ case SP_ATTR_STYLE:
+ sp_style_read_from_object(object->style, object);
+ object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
+ break;
default:
break;
}
@@ -1111,6 +1116,38 @@ sp_object_private_write(SPObject *object, Inkscape::XML::Node *repr, guint flags
} else {
repr->setAttribute("inkscape:collect", NULL);
}
+
+ SPStyle const *const obj_style = SP_OBJECT_STYLE(object);
+ if (obj_style) {
+ gchar *s = sp_style_write_string(obj_style, SP_STYLE_FLAG_IFSET);
+ repr->setAttribute("style", ( *s ? s : NULL ));
+ g_free(s);
+ } else {
+ /** \todo I'm not sure what to do in this case. Bug #1165868
+ * suggests that it can arise, but the submitter doesn't know
+ * how to do so reliably. The main two options are either
+ * leave repr's style attribute unchanged, or explicitly clear it.
+ * Must also consider what to do with property attributes for
+ * the element; see below.
+ */
+ char const *style_str = repr->attribute("style");
+ if (!style_str) {
+ style_str = "NULL";
+ }
+ g_warning("Item's style is NULL; repr style attribute is %s", style_str);
+ }
+
+ /** \note We treat object->style as authoritative. Its effects have
+ * been written to the style attribute above; any properties that are
+ * unset we take to be deliberately unset (e.g. so that clones can
+ * override the property).
+ *
+ * Note that the below has an undesirable consequence of changing the
+ * appearance on renderers that lack CSS support (e.g. SVG tiny);
+ * possibly we should write property attributes instead of a style
+ * attribute.
+ */
+ sp_style_unset_property_attrs (object);
}
return repr;