summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-09-04 18:53:01 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-09-04 18:53:01 +0000
commit7b51b20d1cccdd85e7ad54100fbae1dc755185af (patch)
tree68ccc4af1fbae73c6ebd3740f08d8ea8e20df1c4 /src/selection-chemistry.cpp
parentUpdated to match API changes in style.h (diff)
downloadinkscape-7b51b20d1cccdd85e7ad54100fbae1dc755185af.tar.gz
inkscape-7b51b20d1cccdd85e7ad54100fbae1dc755185af.zip
LPE: add Paste LPE verb + menu item. add scale ratios to curve stitch and path-along-path. remove trailing space in verbs.cpp. Fix initialization of BoolParam
(bzr r3675)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 1e1f135f9..99f66130f 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -1184,6 +1184,54 @@ void sp_selection_paste_style()
_("Paste style"));
}
+void sp_selection_paste_livepatheffect()
+{
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ if (desktop == NULL) return;
+
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
+
+ // check if something is in the clipboard
+ if (clipboard == NULL) {
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing on the clipboard."));
+ return;
+ }
+
+ // check if something is selected
+ if (selection->isEmpty()) {
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to paste live path effect to."));
+ return;
+ }
+
+ paste_defs (&defs_clipboard, sp_desktop_document(desktop));
+
+ Inkscape::XML::Node *repr = (Inkscape::XML::Node *) clipboard->data;
+ const char * effectstr = repr->attribute("inkscape:path-effect");
+ if (!effectstr) {
+ SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Clipboard does not contain a live path effect."));
+ return;
+ }
+
+ for ( GSList const *itemlist = selection->itemList(); itemlist != NULL; itemlist = g_slist_next(itemlist) ) {
+ SPItem *item = reinterpret_cast<SPItem*>(itemlist->data);
+ if ( item && SP_IS_SHAPE(item) ) {
+ Inkscape::XML::Node *selrepr = (Inkscape::XML::Node *) SP_OBJECT_REPR(item);
+ selrepr->setAttribute("inkscape:path-effect", effectstr);
+
+ // set inkscape:original-d for paths. the other shapes don't need this.
+ if ( SP_IS_PATH(item) ) {
+ Inkscape::XML::Node *pathrepr = SP_OBJECT_REPR(item);
+ if ( ! pathrepr->attribute("inkscape:original-d") ) {
+ pathrepr->setAttribute("inkscape:original-d", pathrepr->attribute("d"));
+ }
+ }
+ }
+ }
+
+ sp_document_done(sp_desktop_document (desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT,
+ _("Paste live path effect"));
+}
+
void sp_selection_paste_size (bool apply_x, bool apply_y)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;