From 9be96bd4e854c60dfdcb0009ec6b160a95a82570 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Fri, 19 Dec 2014 09:25:59 -0500 Subject: disable rev 13709, following Bug 1365451, comments 13-16 Fixed bugs: - https://launchpad.net/bugs/1365451 (bzr r13806) --- src/ui/clipboard.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/clipboard.cpp') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 7c82fb230..7661f466d 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -330,13 +330,13 @@ void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* use->setAttribute("xlink:href", id.c_str() ); // Set a default style in rather than so it can be changed. use->setAttribute("style", style ); - +/* disable rev 13709 in rev 13806, following Bug 1365451, comments 13-16 Inkscape::XML::Node *nv_repr = sp_desktop_namedview(SP_ACTIVE_DESKTOP)->getRepr(); gdouble scale_units = Inkscape::Util::Quantity::convert(1, nv_repr->attribute("inkscape:document-units"), "px"); gchar *transform_str = sp_svg_transform_write(Geom::Scale(scale_units, scale_units)); use->setAttribute("transform", transform_str); g_free(transform_str); - +*/ _root->appendChild(use); // This min and max sets offsets, we don't have any so set to zero. -- cgit v1.2.3 From 30b6a43219b66aba1a9ebade8aca50910f2c25cc Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 10:39:39 -0500 Subject: Deprecate and remove sp_desktop_selection in favor of SPDesktop::getSelection (bzr r13809) --- src/ui/clipboard.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ui/clipboard.cpp') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 7661f466d..9275d3bde 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -201,7 +201,7 @@ void ClipboardManagerImpl::copy(SPDesktop *desktop) if ( desktop == NULL ) { return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // Special case for when the gradient dragger is active - copies gradient color if (desktop->event_context->get_drag()) { @@ -435,7 +435,7 @@ bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop) } // check whether something is selected - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { _userWarn(desktop, _("Select object(s) to paste style to.")); return false; @@ -488,7 +488,7 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a if ( desktop == NULL ) { return false; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { _userWarn(desktop, _("Select object(s) to paste size to.")); return false; @@ -551,7 +551,7 @@ bool ClipboardManagerImpl::pastePathEffect(SPDesktop *desktop) return false; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection && selection->isEmpty()) { _userWarn(desktop, _("Select object(s) to paste live path effect to.")); return false; -- cgit v1.2.3 From 6c78ab7deeea3b32791437ade35e8911e7c73c8e Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 14:58:38 -0500 Subject: Purge sp_desktop_namedview in favor of SPDesktop::getNamedView (bzr r13810) --- src/ui/clipboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/clipboard.cpp') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 9275d3bde..310df419e 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -331,7 +331,7 @@ void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* // Set a default style in rather than so it can be changed. use->setAttribute("style", style ); /* disable rev 13709 in rev 13806, following Bug 1365451, comments 13-16 - Inkscape::XML::Node *nv_repr = sp_desktop_namedview(SP_ACTIVE_DESKTOP)->getRepr(); + Inkscape::XML::Node *nv_repr = SP_ACTIVE_DESKTOP->getNamedView()->getRepr(); gdouble scale_units = Inkscape::Util::Quantity::convert(1, nv_repr->attribute("inkscape:document-units"), "px"); gchar *transform_str = sp_svg_transform_write(Geom::Scale(scale_units, scale_units)); use->setAttribute("transform", transform_str); -- cgit v1.2.3 From 3dbf9a08680c6d7252c79397dbf12082ead61bd7 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 16:58:32 -0500 Subject: Remove sp_desktop_document and finish cleanup of desktop-handles.h (bzr r13820) --- src/ui/clipboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/clipboard.cpp') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 310df419e..c2465932b 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -37,7 +37,7 @@ #include "inkscape.h" #include "io/stringstream.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" // for sp_desktop_set_style, used in _pasteStyle #include "document.h" #include "document-private.h" -- cgit v1.2.3 From 45b5e7ad68a9166a61f96b3ffc469818a2bf4fcd Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Thu, 15 Jan 2015 14:03:17 -0500 Subject: during copy and paste, scale stock symbols from units of 'px' to 'document-units'. (Bug 1365451) Fixed bugs: - https://launchpad.net/bugs/1365451 (bzr r13853) --- src/ui/clipboard.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'src/ui/clipboard.cpp') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index c2465932b..dabebe1be 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -107,7 +107,7 @@ class ClipboardManagerImpl : public ClipboardManager { public: virtual void copy(SPDesktop *desktop); virtual void copyPathParameter(Inkscape::LivePathEffect::PathParam *); - virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style); + virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style, bool user_symbol); virtual bool paste(SPDesktop *desktop, bool in_place); virtual bool pasteStyle(SPDesktop *desktop); virtual bool pasteSize(SPDesktop *desktop, bool separately, bool apply_x, bool apply_y); @@ -303,7 +303,7 @@ void ClipboardManagerImpl::copyPathParameter(Inkscape::LivePathEffect::PathParam * Copy a symbol from the symbol dialog. * @param symbol The Inkscape::XML::Node for the symbol. */ -void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* style) +void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* style, bool user_symbol) { //std::cout << "ClipboardManagerImpl::copySymbol" << std::endl; if ( symbol == NULL ) { @@ -326,17 +326,28 @@ void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* Glib::ustring id("#"); id += symbol->attribute("id"); + gdouble scale_units = 1; // scale from "px" to "document-units" + Inkscape::XML::Node *nv_repr = SP_ACTIVE_DESKTOP->getNamedView()->getRepr(); + if (nv_repr->attribute("inkscape:document-units")) + scale_units = Inkscape::Util::Quantity::convert(1, "px", nv_repr->attribute("inkscape:document-units")); + SPObject *cmobj = _clipboardSPDoc->getObjectByRepr(repr); + if (cmobj && !user_symbol) { // convert only stock symbols + if (!Geom::are_near(scale_units, 1.0, Geom::EPSILON)) { + dynamic_cast(cmobj)->scaleChildItemsRec(Geom::Scale(scale_units), + Geom::Point(0, SP_ACTIVE_DESKTOP->getDocument()->getHeight().value("px")), + false); + } + } + Inkscape::XML::Node *use = _doc->createElement("svg:use"); use->setAttribute("xlink:href", id.c_str() ); // Set a default style in rather than so it can be changed. use->setAttribute("style", style ); -/* disable rev 13709 in rev 13806, following Bug 1365451, comments 13-16 - Inkscape::XML::Node *nv_repr = SP_ACTIVE_DESKTOP->getNamedView()->getRepr(); - gdouble scale_units = Inkscape::Util::Quantity::convert(1, nv_repr->attribute("inkscape:document-units"), "px"); - gchar *transform_str = sp_svg_transform_write(Geom::Scale(scale_units, scale_units)); - use->setAttribute("transform", transform_str); - g_free(transform_str); -*/ + if (!Geom::are_near(scale_units, 1.0, Geom::EPSILON)) { + gchar *transform_str = sp_svg_transform_write(Geom::Scale(1.0/scale_units)); + use->setAttribute("transform", transform_str); + g_free(transform_str); + } _root->appendChild(use); // This min and max sets offsets, we don't have any so set to zero. -- cgit v1.2.3