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

void sp_nodepath_select_all_from_subpath ( Inkscape::NodePath::Path nodepath,
bool  invert 
)

If nothing selected, does the same as sp_nodepath_select_all(); otherwise selects/inverts all nodes in all subpaths that have selected nodes (i.e., similar to "select all in layer", with the "selected" subpaths being treated as "layers" in the path).

Definition at line 2944 of file nodepath.cpp.

References Inkscape::NodePath::SubPath::nodes, Inkscape::NodePath::Path::selected, sp_nodepath_node_select(), sp_nodepath_select_all(), Inkscape::NodePath::Node::subpath, and Inkscape::NodePath::Path::subpaths.

{
    if (!nodepath) return;

    if (g_list_length (nodepath->selected) == 0) {
        sp_nodepath_select_all (nodepath, invert);
        return;
    }

    GList *copy = g_list_copy (nodepath->selected); // copy initial selection so that selecting in the loop does not affect us
    GSList *subpaths = NULL;

    for (GList *l = copy; l != NULL; l = l->next) {
        Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
        Inkscape::NodePath::SubPath *subpath = n->subpath;
        if (!g_slist_find (subpaths, subpath))
            subpaths = g_slist_prepend (subpaths, subpath);
    }

    for (GSList *sp = subpaths; sp != NULL; sp = sp->next) {
        Inkscape::NodePath::SubPath *subpath = (Inkscape::NodePath::SubPath *) sp->data;
        for (GList *nl = subpath->nodes; nl != NULL; nl = nl->next) {
            Inkscape::NodePath::Node *node = (Inkscape::NodePath::Node *) nl->data;
            sp_nodepath_node_select(node, TRUE, invert? !g_list_find(copy, node) : TRUE);
        }
    }

    g_slist_free (subpaths);
    g_list_free (copy);
}


Generated by  Doxygen 1.6.0   Back to index