From 66095b4a7c8d8c38ffe727490f90de088f488574 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 10 Jan 2017 13:44:57 +0100 Subject: Another scaling option to test. (bzr r15406) --- src/file.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 2 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 756bc55bb..629e8205b 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -433,6 +433,7 @@ bool sp_file_open(const Glib::ustring &uri, scaleDialog.add_button(_("Ignore"), 3); scaleDialog.add_button("Scale test - group", 4); scaleDialog.add_button("Scale test - children", 5); + scaleDialog.add_button("Scale test - all", 6); gint response = scaleDialog.run(); backup = backupButton.get_active(); @@ -519,9 +520,34 @@ bool sp_file_open(const Glib::ustring &uri, prefs->setBool("/options/transform/rectcorners", transform_rectcorners); prefs->setBool("/options/transform/pattern", transform_pattern); prefs->setBool("/options/transform/gradient", transform_gradient); + + } else if (response == 6) { + + std::cout << "Respons 6a" << std::endl; + + // Save preferences + bool onlysensitive = prefs->getBool("/options/kbselection/onlysensitive",true); + bool onlyvisible = prefs->getBool("/options/kbselection/onlyvisible", true); + + prefs->setBool("/options/kbselection/onlysensitive", false); + prefs->setBool("/options/kbselection/onlyvisible", false); + + Inkscape::Selection *selection = desktop->getSelection(); + Inkscape::SelectionHelper::selectAllInAll( desktop ); + + double height = root->height.computed; + selection->setScaleRelative( Geom::Point(0,height), Geom::Scale(96.0/90.0,96.0/90.0) ); + std::cout << " scaling: " << 96.0/90.0 << std::endl; + selection->clear(); + + prefs->setBool("/options/kbselection/onlysensitive", onlysensitive); + prefs->setBool("/options/kbselection/onlyvisible", onlyvisible ); + + did_scaling = true; + } - need_fix_box3d = true; + need_fix_box3d = false; // setScaleRelative() handles box3d need_fix_guides = true; // Always fix guides } @@ -550,6 +576,7 @@ bool sp_file_open(const Glib::ustring &uri, scaleDialog.add_button(_("Ignore"), 3); scaleDialog.add_button("Scale test - group", 4); scaleDialog.add_button("Scale test - children", 5); + scaleDialog.add_button("Scale test - all", 6); gint response = scaleDialog.run(); backup = backupButton.get_active(); @@ -671,9 +698,47 @@ bool sp_file_open(const Glib::ustring &uri, prefs->setBool("/options/transform/gradient", transform_gradient); did_scaling = true; + } - need_fix_box3d = true; + } else if (response == 6) { + + std::cout << "Response 6b" << std::endl; + double old_height = root->height.computed; + Inkscape::Util::Quantity width = + Inkscape::Util::Quantity(doc->getWidth().value("px")/ratio, "px" ); + Inkscape::Util::Quantity height = + Inkscape::Util::Quantity(doc->getHeight().value("px")/ratio,"px" ); + doc->setWidthAndHeight( width, height, false ); + + if (!root->viewBox_set) { + + // Save preferences + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool onlysensitive = prefs->getBool("/options/kbselection/onlysensitive",true); + bool onlyvisible = prefs->getBool("/options/kbselection/onlyvisible", true); + + prefs->setBool("/options/kbselection/onlysensitive", false); + prefs->setBool("/options/kbselection/onlyvisible", false); + + Inkscape::Selection *selection = desktop->getSelection(); + Inkscape::SelectionHelper::selectAllInAll( desktop ); + std::cout << " scaling: " << 96.0/90.0 << std::endl; + double height = root->height.computed; + + // So far we have just enlarged the drawing but due to the + // inverted coordinate system we must scale around the old + // height position. + selection->setScaleRelative( Geom::Point(0,old_height), Geom::Scale(96.0/90.0,96.0/90.0) ); + selection->clear(); + + prefs->setBool("/options/kbselection/onlysensitive", onlysensitive); + prefs->setBool("/options/kbselection/onlyvisible", onlyvisible ); + + did_scaling = true; + } + + need_fix_box3d = false; // setScaleRelative() handls box3s need_fix_guides = true; // Only fix guides if drawing scaled } else { -- cgit v1.2.3 From 3d488c4a3091d4e14c045e85aa20b1ec96b479c0 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 10 Jan 2017 13:55:18 +0100 Subject: Remove debugging lines from last commit. (bzr r15407) --- src/file.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 629e8205b..9e96361c3 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -523,8 +523,6 @@ bool sp_file_open(const Glib::ustring &uri, } else if (response == 6) { - std::cout << "Respons 6a" << std::endl; - // Save preferences bool onlysensitive = prefs->getBool("/options/kbselection/onlysensitive",true); bool onlyvisible = prefs->getBool("/options/kbselection/onlyvisible", true); @@ -537,7 +535,6 @@ bool sp_file_open(const Glib::ustring &uri, double height = root->height.computed; selection->setScaleRelative( Geom::Point(0,height), Geom::Scale(96.0/90.0,96.0/90.0) ); - std::cout << " scaling: " << 96.0/90.0 << std::endl; selection->clear(); prefs->setBool("/options/kbselection/onlysensitive", onlysensitive); @@ -703,7 +700,6 @@ bool sp_file_open(const Glib::ustring &uri, } else if (response == 6) { - std::cout << "Response 6b" << std::endl; double old_height = root->height.computed; Inkscape::Util::Quantity width = Inkscape::Util::Quantity(doc->getWidth().value("px")/ratio, "px" ); @@ -723,7 +719,6 @@ bool sp_file_open(const Glib::ustring &uri, Inkscape::Selection *selection = desktop->getSelection(); Inkscape::SelectionHelper::selectAllInAll( desktop ); - std::cout << " scaling: " << 96.0/90.0 << std::endl; double height = root->height.computed; // So far we have just enlarged the drawing but due to the -- cgit v1.2.3 From 8907ced418b6c40782d2d2c0f3f944edcb3c08df Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Fri, 20 Jan 2017 20:19:49 +0100 Subject: Fixes bugs in copy LPE's. #1656093:Paste path effect doesn't work on 0.92 and #1656527:Copy & paste of group with shaped path corrupts it, in v0.92 Fixed bugs: - https://launchpad.net/bugs/1656093 - https://launchpad.net/bugs/1656527 (bzr r15426) --- src/file.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 9e96361c3..e8248bb8e 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1631,8 +1631,12 @@ void sp_import_document(SPDesktop *desktop, SPDocument *clipdoc, bool in_place) for (Inkscape::XML::Node *obj = clipboard->firstChild() ; obj ; obj = obj->next()) { if(target_document->getObjectById(obj->attribute("id"))) continue; Inkscape::XML::Node *obj_copy = obj->duplicate(target_document->getReprDoc()); - target_parent->appendChild(obj_copy); + SPObject * pasted = desktop->currentLayer()->appendChildRepr(obj_copy); Inkscape::GC::release(obj_copy); + SPLPEItem * pasted_lpe_item = dynamic_cast(pasted); + if (pasted_lpe_item){ + pasted_lpe_item->forkPathEffectsIfNecessary(1); + } pasted_objects_not.push_back(obj_copy); } Inkscape::Selection *selection = desktop->getSelection(); -- cgit v1.2.3