summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ae22ad7)
raw | patch | inline | side by side (parent: ae22ad7)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 28 Mar 2008 21:10:04 +0000 (21:10 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 28 Mar 2008 21:10:04 +0000 (21:10 +0000) |
src/ui/clipboard.cpp | patch | blob | history |
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 4ee838708dc7e75440c591e1c32de814d8a0eed5..cc1b58a55aabe2663d985365ccf98cbc6462b181 100644 (file)
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
#include "sp-clippath.h"
#include "sp-mask.h"
#include "sp-textpath.h"
+#include "sp-rect.h"
#include "live_effects/lpeobject.h"
#include "live_effects/parameter/path.h"
#include "svg/svg.h" // for sp_svg_transform_write, used in _copySelection
#include "text-editing.h"
#include "tools-switch.h"
#include "live_effects/n-art-bpath-2geom.h"
+#include "path-chemistry.h"
/// @brief Made up mimetype to represent Gdk::Pixbuf clipboard contents
#define CLIPBOARD_GDK_PIXBUF_TARGET "image/x-gdk-pixbuf"
segfaulting in fork_private_if_necessary(). */
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if ( desktop == NULL ) return false;
+ if ( desktop == NULL )
+ return false;
+
Inkscape::Selection *selection = sp_desktop_selection(desktop);
if (selection->isEmpty()) {
_userWarn(desktop, _("Select <b>object(s)</b> to paste live path effect to."));
return false;
}
- Inkscape::XML::Node *root, *clipnode;
- gchar const *effect;
SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg");
- if ( tempdoc == NULL ) goto no_effect;
-
- root = sp_document_repr_root(tempdoc),
- clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1);
- if ( clipnode == NULL ) goto no_effect;
- effect = clipnode->attribute("inkscape:path-effect");
- if ( effect == NULL ) goto no_effect;
-
- _pasteDefs(tempdoc);
- for (GSList *item = const_cast<GSList *>(selection->itemList()) ; item ; item = item->next) {
- _applyPathEffect(reinterpret_cast<SPItem*>(item->data), effect);
+ 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(false);
+ for (GSList *item = const_cast<GSList *>(selection->itemList()) ; item ; item = item->next) {
+ _applyPathEffect(reinterpret_cast<SPItem*>(item->data), effect);
+ }
+ return true;
+ }
+ }
}
- return true;
-
- no_effect:
+
+ // no_effect:
_userWarn(desktop, _("No effect on the clipboard."));
return false;
}
void ClipboardManagerImpl::_applyPathEffect(SPItem *item, gchar const *effect)
{
if ( item == NULL ) return;
+ if ( SP_IS_RECT(item) ) return;
if (SP_IS_LPE_ITEM(item))
{