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

bool Inkscape::UI::ClipboardManagerImpl::pastePathEffect (  ) [virtual]

Applies a path effect from the clipboard to the selected path.

Todo:
FIXME: pastePathEffect crashes when moving the path with the applied effect, segfaulting in fork_private_if_necessary().

Implements Inkscape::UI::ClipboardManager.

Definition at line 472 of file clipboard.cpp.

References _applyPathEffect(), _pasteDefs(), _retrieveClipboard(), _userWarn(), Inkscape::XML::Node::attribute(), Inkscape::Selection::isEmpty(), Inkscape::Selection::itemList(), and sp_repr_lookup_name().

{
    /** @todo FIXME: pastePathEffect crashes when moving the path with the applied effect,
        segfaulting in fork_private_if_necessary(). */

    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
    if ( desktop == NULL )
        return false;

    Inkscape::Selection *selection = sp_desktop_selection(desktop);
    if (selection && selection->isEmpty()) {
        _userWarn(desktop, _("Select <b>object(s)</b> to paste live path effect to."));
        return false;
    }

    SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg");
    if ( tempdoc ) {
        Inkscape::XML::Node *root = sp_document_repr_root(tempdoc);
        Inkscape::XML::Node *clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1);
        if ( clipnode ) {
            gchar const *effect = clipnode->attribute("inkscape:path-effect");
            if ( effect ) {
                _pasteDefs(tempdoc);
                // make sure all selected items are converted to paths first (i.e. rectangles)
                sp_selected_path_to_curves(desktop, false);
                for (GSList *item = const_cast<GSList *>(selection->itemList()) ; item ; item = item->next) {
                    _applyPathEffect(reinterpret_cast<SPItem*>(item->data), effect);
                }

                return true;
            }
        }
    }

    // no_effect:
    _userWarn(desktop, _("No effect on the clipboard."));
    return false;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index