Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

static void sp_root_child_added ( SPObject object,
Inkscape::XML::Node child,
Inkscape::XML::Node ref 
) [static]

This routine is for adding a child SVG object to an SPRoot object. The SPRoot object is taken to be an SPGroup.

Definition at line 352 of file sp-root.cpp.

References SPRoot::defs, and Inkscape::XML::Node::name().

Referenced by sp_root_class_init().

{
    SPRoot *root = (SPRoot *) object;
    SPGroup *group = (SPGroup *) object;

    if (((SPObjectClass *) (parent_class))->child_added)
        (* ((SPObjectClass *) (parent_class))->child_added)(object, child, ref);

    SPObject *co = object->document->getObjectByRepr(child);
    g_assert (co != NULL || !strcmp("comment", child->name())); // comment repr node has no object

    if (co && SP_IS_DEFS(co)) {
        SPObject *c;
        /* We search for first <defs> node - it is not beautiful, but works */
        for (c = sp_object_first_child(SP_OBJECT(group)) ; c != NULL; c = SP_OBJECT_NEXT(c) ) {
            if (SP_IS_DEFS(c)) {
                root->defs = SP_DEFS(c);
                break;
            }
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index