summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-01-26 16:44:00 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-01-26 16:44:00 +0000
commitc78d5eac14cd2dee9293418919ba08e6244c9058 (patch)
tree6df4a5be49d86df7d2efb9dffbf2d32e76427604 /src/selection-chemistry.cpp
parentLPE bend path was badly broken. fixed now. (diff)
downloadinkscape-c78d5eac14cd2dee9293418919ba08e6244c9058.tar.gz
inkscape-c78d5eac14cd2dee9293418919ba08e6244c9058.zip
add copy button to LPE pathparam
(bzr r4600)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp51
1 files changed, 49 insertions, 2 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 381f45e0d..caf32ce3e 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -20,6 +20,8 @@
# include "config.h"
#endif
+#include "selection-chemistry.h"
+
#include <gtkmm/clipboard.h>
#include "svg/svg.h"
@@ -79,12 +81,12 @@
#include "gradient-drag.h"
#include "uri-references.h"
#include "live_effects/lpeobject.h"
+#include "live_effects/parameter/path.h"
+#include "libnr/nr-convert2geom.h"
using NR::X;
using NR::Y;
-#include "selection-chemistry.h"
-
/* fixme: find a better place */
Inkscape::XML::Document *clipboard_document = NULL;
GSList *clipboard = NULL;
@@ -1123,6 +1125,51 @@ void sp_selection_copy()
g_slist_free ((GSList *) items);
}
+
+void sp_selection_copy_lpe_pathparam(Inkscape::LivePathEffect::PathParam * pathparam)
+{
+ if (pathparam == NULL)
+ return;
+
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ if (desktop == NULL)
+ return;
+
+ if (!clipboard_document) {
+ clipboard_document = new Inkscape::XML::SimpleDocument();
+ }
+
+ // clear old defs clipboard
+ while (defs_clipboard) {
+ Inkscape::GC::release((Inkscape::XML::Node *) defs_clipboard->data);
+ defs_clipboard = g_slist_remove (defs_clipboard, defs_clipboard->data);
+ }
+
+ // clear style clipboard
+ if (style_clipboard) {
+ sp_repr_css_attr_unref (style_clipboard);
+ style_clipboard = NULL;
+ }
+
+ //clear main clipboard
+ while (clipboard) {
+ Inkscape::GC::release((Inkscape::XML::Node *) clipboard->data);
+ clipboard = g_slist_remove(clipboard, clipboard->data);
+ }
+
+ // make new path node and put svgd as 'd' attribute
+ Inkscape::XML::Node *newnode = clipboard_document->createElement("svg:path");
+ gchar * svgd = pathparam->param_writeSVGValue();
+ newnode->setAttribute("d", svgd);
+ g_free(svgd);
+
+ clipboard = g_slist_prepend(clipboard, newnode);
+
+ Geom::Rect bnds = Geom::bounds_exact(*pathparam);
+ size_clipboard = from_2geom(bnds);
+}
+
+
//____________________________________________________________________________
/** Paste the bitmap in the clipboard if one is in there.