112
113
sp_object_repr_order_changed
116
// A friend class used to set internal members on SPObject so as to not expose settors in SPObject's public API
122
* Null's the id member of an SPObject without attempting to free prior contents.
124
static void setIdNull( SPObject* obj ) {
131
* Sets the id member of an object, freeing any prior content.
133
static void setId( SPObject* obj, gchar const* id ) {
134
if (obj && (id != obj->id) ) {
140
obj->id = g_strdup(id);
115
147
static GObjectClass *parent_class;
188
220
object->_successor = NULL;
190
222
// FIXME: now we create style for all objects, but per SVG, only the following can have style attribute:
191
// vg, g, defs, desc, title, symbol, use, image, switch, path, rect, circle, ellipse, line, polyline,
192
// polygon, text, tspan, tref, textPath, altGlyph, glyphRef, marker, linearGradient, radialGradient,
223
// vg, g, defs, desc, title, symbol, use, image, switch, path, rect, circle, ellipse, line, polyline,
224
// polygon, text, tspan, tref, textPath, altGlyph, glyphRef, marker, linearGradient, radialGradient,
193
225
// stop, pattern, clipPath, mask, filter, feImage, a, font, glyph, missing-glyph, foreignObject
194
226
object->style = sp_style_new_from_object(object);
506
542
/** Queues the object for orphan collection */
508
SPObject::requestOrphanCollection() {
543
void SPObject::requestOrphanCollection() {
509
544
g_return_if_fail(document != NULL);
511
546
// do not remove style or script elements (Bug #276244)
512
if (SP_IS_STYLE_ELEM(this))
514
if (SP_IS_SCRIPT(this))
517
document->queueForOrphanCollection(this);
520
* This is a temporary hack added to make fill&stroke rebuild its
521
* gradient list when the defs are vacuumed. gradient-vector.cpp
522
* listens to the modified signal on defs, and now we give it that
523
* signal. Mental says that this should be made automatic by
524
* merging SPObjectGroup with SPObject; SPObjectGroup would issue
525
* this signal automatically. Or maybe just derive SPDefs from
529
this->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG);
547
if (SP_IS_STYLE_ELEM(this)) {
549
} else if (SP_IS_SCRIPT(this)) {
551
} else if (SP_IS_PAINT_SERVER(this) && static_cast<SPPaintServer*>(this)->isSwatch() ) {
553
} else if (IS_COLORPROFILE(this)) {
556
document->queueForOrphanCollection(this);
559
* This is a temporary hack added to make fill&stroke rebuild its
560
* gradient list when the defs are vacuumed. gradient-vector.cpp
561
* listens to the modified signal on defs, and now we give it that
562
* signal. Mental says that this should be made automatic by
563
* merging SPObjectGroup with SPObject; SPObjectGroup would issue
564
* this signal automatically. Or maybe just derive SPDefs from
568
this->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG);
532
572
/** Sends the delete signal to all children of this object recursively */
812
sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned)
851
void sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned)
814
853
debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object));
837
876
/* If we are not cloned, and not seeking, force unique id */
838
877
gchar const *id = object->repr->attribute("id");
839
878
if (!document->isSeeking()) {
840
gchar *realid = sp_object_get_unique_id(object, id);
841
g_assert(realid != NULL);
880
gchar *realid = sp_object_get_unique_id(object, id);
881
g_assert(realid != NULL);
843
object->document->bindObjectToId(realid, object);
883
object->document->bindObjectToId(realid, object);
884
SPObjectImpl::setId(object, realid);
846
888
/* Redefine ID, if required */
847
if ((id == NULL) || (strcmp(id, realid) != 0)) {
848
object->repr->setAttribute("id", realid);
889
if ((id == NULL) || (strcmp(id, object->getId()) != 0)) {
890
object->repr->setAttribute("id", object->getId());
851
893
// bind if id, but no conflict -- otherwise, we can expect
852
894
// a subsequent setting of the id attribute
853
895
if (!object->document->getObjectById(id)) {
854
896
object->document->bindObjectToId(id, object);
855
object->id = g_strdup(id);
897
SPObjectImpl::setId(object, id);
860
g_assert(object->id == NULL);
902
g_assert(object->getId() == NULL);
863
905
/* Invoke derived methods, if any */
986
document->bindObjectToId(object->id, NULL);
1038
if (object->getId()) {
1039
document->bindObjectToId(object->getId(), NULL);
1040
SPObjectImpl::setId(object, 0);
991
object->id = g_strdup((char const*)new_id);
992
document->bindObjectToId(object->id, object);
1044
SPObjectImpl::setId(object, new_id);
1045
document->bindObjectToId(object->getId(), object);
997
1048
g_free(object->_default_label);
1130
1181
repr->setAttribute("inkscape:collect", NULL);
1133
repr->setAttribute("id", object->id);
1184
repr->setAttribute("id", object->getId());
1135
1186
if (object->xml_space.set) {
1136
1187
char const *xml_space;
1204
/** Used both to create reprs in the original document, and to create
1255
/** Used both to create reprs in the original document, and to create
1205
1256
* reprs in another document (e.g. a temporary document used when
1206
1257
* saving as "Plain SVG"
1326
* Request modified always bubbles *up* the tree, as opposed to
1327
* request display update, which trickles down and relies on the
1377
* Request modified always bubbles *up* the tree, as opposed to
1378
* request display update, which trickles down and relies on the
1328
1379
* flags set during this pass...
1359
1410
* Emits the MODIFIED signal with the object's flags.
1360
* The object's mflags are the original set aside during the update pass for
1411
* The object's mflags are the original set aside during the update pass for
1361
1412
* later delivery here. Once emitModified() is called, those flags don't
1362
1413
* need to be stored any longer.
1748
1799
for (const SPObject *child = firstChild(); child; child = child->next)
1750
1801
Inkscape::XML::NodeType child_type = child->repr->type();
1752
1803
if (child_type == Inkscape::XML::ELEMENT_NODE) {
1753
1804
GString * new_text = child->textualContent();
1754
1805
g_string_append(text, new_text->str);