Logo Search packages:      
Sourcecode: inkscape version File versions

SPObject * Inkscape::previous_layer ( SPObject root,
SPObject layer 
)

Finds the previous layer under root, relative to layer in depth-first order.

Returns:
NULL if there are no prior layers under root.

Definition at line 139 of file layer-fns.cpp.

References last_child_layer(), and previous_sibling_layer().

Referenced by Inkscape::LayerVerb::perform().

                                                          {
    using Inkscape::Algorithms::find_last_if;

    g_return_val_if_fail(layer != NULL, NULL);

    SPObject *child(last_child_layer(layer));
    if (child) {
        return child;
    } else if ( layer != root ) {
        SPObject *sibling(previous_sibling_layer(layer));
        if (sibling) {
            return sibling;
        } else {
            return last_elder_layer(root, SP_OBJECT_PARENT(layer));
        }
    }

    return NULL;
}


Generated by  Doxygen 1.6.0   Back to index