From e6fb3530bee1ba272d7399f26634b27a335798cb Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Thu, 7 Dec 2017 11:02:44 +0100 Subject: This commit: *Allow boolops operation with non paths converting them to path first *Allow convert to stroke non paths converting previously to paths *Allow combine with use elements converting it to paths first *Allow convert to curves use/clone elements converting to curves --- src/path-chemistry.cpp | 15 +++++---------- src/verbs.cpp | 7 +++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index b824d15c7..9ad6c8c76 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -55,7 +55,7 @@ ObjectSet::combine(bool skip_undo) { //Inkscape::Selection *selection = desktop->getSelection(); SPDocument *doc = document(); - + unlinkRecursive(true); std::vector items_copy(items().begin(), items().end()); if (items_copy.size() < 1) { @@ -299,14 +299,14 @@ void ObjectSet::toCurves(bool skip_undo) desktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to convert to path.")); return; } - + bool did = false; if (desktop()) { desktop()->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Converting objects to paths...")); // set "busy" cursor desktop()->setWaitingCursor(); } - + unlinkRecursive(true); std::vector selected(items().begin(), items().end()); std::vector to_select; clear(); @@ -337,7 +337,7 @@ void ObjectSet::toLPEItems() if (isEmpty()) { return; } - + unlinkRecursive(true); std::vector selected(items().begin(), items().end()); std::vector to_select; clear(); @@ -366,12 +366,7 @@ sp_item_list_to_curves(const std::vector &items, std::vector& { continue; } - //TODO: decide if we want to unlink clones or not, for now keep previous functionality retaining clones as is - SPUse *use = dynamic_cast(item); - if (use) { - continue; - } - + SPPath *path = dynamic_cast(item); if (path && !path->_curve_before_lpe) { // remove connector attributes diff --git a/src/verbs.cpp b/src/verbs.cpp index f01a3c79c..dc378de7c 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1125,21 +1125,27 @@ void SelectionVerb::perform(SPAction *action, void *data) bool handled = true; switch (reinterpret_cast(data)) { case SP_VERB_SELECTION_UNION: + selection->toCurves(true); selection->pathUnion(); break; case SP_VERB_SELECTION_INTERSECT: + selection->toCurves(true); selection->pathIntersect(); break; case SP_VERB_SELECTION_DIFF: + selection->toCurves(true); selection->pathDiff(); break; case SP_VERB_SELECTION_SYMDIFF: + selection->toCurves(true); selection->pathSymDiff(); break; case SP_VERB_SELECTION_CUT: + selection->toCurves(true); selection->pathCut(); break; case SP_VERB_SELECTION_SLICE: + selection->toCurves(true); selection->pathSlice(); break; case SP_VERB_SELECTION_GROW: @@ -1253,6 +1259,7 @@ void SelectionVerb::perform(SPAction *action, void *data) tools_switch(dt, TOOLS_NODES); break; case SP_VERB_SELECTION_OUTLINE: + selection->toCurves(true); sp_selected_path_outline(dt); break; case SP_VERB_SELECTION_OUTLINE_LEGACY: -- cgit v1.2.3 From aeb9391d258b5f76c64333633286abf841d508c5 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Thu, 7 Dec 2017 15:45:26 +0100 Subject: Make optional convert clone to path by a prefs option --- src/path-chemistry.cpp | 15 ++++++++++++--- src/ui/dialog/inkscape-preferences.cpp | 5 +++++ src/ui/dialog/inkscape-preferences.h | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 9ad6c8c76..d87dd96cd 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -55,7 +55,10 @@ ObjectSet::combine(bool skip_undo) { //Inkscape::Selection *selection = desktop->getSelection(); SPDocument *doc = document(); - unlinkRecursive(true); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/options/pathoperationsunlink/value", true)) { + unlinkRecursive(true); + } std::vector items_copy(items().begin(), items().end()); if (items_copy.size() < 1) { @@ -306,7 +309,10 @@ void ObjectSet::toCurves(bool skip_undo) // set "busy" cursor desktop()->setWaitingCursor(); } - unlinkRecursive(true); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/options/pathoperationsunlink/value", true)) { + unlinkRecursive(true); + } std::vector selected(items().begin(), items().end()); std::vector to_select; clear(); @@ -337,7 +343,10 @@ void ObjectSet::toLPEItems() if (isEmpty()) { return; } - unlinkRecursive(true); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/options/pathoperationsunlink/value", true)) { + unlinkRecursive(true); + } std::vector selected(items().begin(), items().end()); std::vector to_select; clear(); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index b2d4c5837..803dede7e 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1394,6 +1394,11 @@ void InkscapePreferences::initPageBehavior() _page_clones.add_line(true, "", _clone_relink_on_duplicate, "", _("When duplicating a selection containing both a clone and its original (possibly in groups), relink the duplicated clone to the duplicated original instead of the old original")); + _page_clones.add_group_header( _("Unlinking clones")); + _clone_to_curves.init ( _("Paths operations unlink clones"), "/options/pathoperationsunlink/value", true); + _page_clones.add_line(true, "", _clone_to_curves, "", + _("This paths operations unlink clones: stroke to path, boolops operations, to curves, combine")); + //TRANSLATORS: Heading for the Inkscape Preferences "Clones" Page this->AddPage(_page_clones, _("Clones"), iter_behavior, PREFS_PAGE_BEHAVIOR_CLONES); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index a197a8e65..58e61470c 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -272,6 +272,7 @@ protected: UI::Widget::PrefRadioButton _clone_option_unlink; UI::Widget::PrefRadioButton _clone_option_delete; UI::Widget::PrefCheckButton _clone_relink_on_duplicate; + UI::Widget::PrefCheckButton _clone_to_curves; UI::Widget::PrefCheckButton _mask_mask_on_top; UI::Widget::PrefCheckButton _mask_mask_remove; -- cgit v1.2.3 From 0715e9d74e3a13e01a4497568b11d3e4f84e7750 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Fri, 8 Dec 2017 20:45:44 +0100 Subject: Fix strings, thanks Maren --- src/ui/dialog/inkscape-preferences.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 803dede7e..562617e6d 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1395,9 +1395,9 @@ void InkscapePreferences::initPageBehavior() _("When duplicating a selection containing both a clone and its original (possibly in groups), relink the duplicated clone to the duplicated original instead of the old original")); _page_clones.add_group_header( _("Unlinking clones")); - _clone_to_curves.init ( _("Paths operations unlink clones"), "/options/pathoperationsunlink/value", true); + _clone_to_curves.init ( _("Path operations unlink clones"), "/options/pathoperationsunlink/value", true); _page_clones.add_line(true, "", _clone_to_curves, "", - _("This paths operations unlink clones: stroke to path, boolops operations, to curves, combine")); + _("The following path operations will unlink clones: Stroke to path, Boolean operations, Object to Path, Combine")); //TRANSLATORS: Heading for the Inkscape Preferences "Clones" Page this->AddPage(_page_clones, _("Clones"), iter_behavior, PREFS_PAGE_BEHAVIOR_CLONES); -- cgit v1.2.3 From 4b8609e0cce219ec683e8901d1c47abec07bf022 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sat, 9 Dec 2017 02:14:27 +0100 Subject: Add break apart. Thanks Maren --- src/path-chemistry.cpp | 3 --- src/ui/dialog/inkscape-preferences.cpp | 2 +- src/verbs.cpp | 2 ++ 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index d87dd96cd..9e75b7841 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -56,9 +56,6 @@ ObjectSet::combine(bool skip_undo) //Inkscape::Selection *selection = desktop->getSelection(); SPDocument *doc = document(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (prefs->getBool("/options/pathoperationsunlink/value", true)) { - unlinkRecursive(true); - } std::vector items_copy(items().begin(), items().end()); if (items_copy.size() < 1) { diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 562617e6d..dcc3033fa 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1397,7 +1397,7 @@ void InkscapePreferences::initPageBehavior() _page_clones.add_group_header( _("Unlinking clones")); _clone_to_curves.init ( _("Path operations unlink clones"), "/options/pathoperationsunlink/value", true); _page_clones.add_line(true, "", _clone_to_curves, "", - _("The following path operations will unlink clones: Stroke to path, Boolean operations, Object to Path, Combine")); + _("The following path operations will unlink clones: Stroke to path, Object to Path, Boolean operations, Combine and Break Apart")); //TRANSLATORS: Heading for the Inkscape Preferences "Clones" Page this->AddPage(_page_clones, _("Clones"), iter_behavior, PREFS_PAGE_BEHAVIOR_CLONES); diff --git a/src/verbs.cpp b/src/verbs.cpp index dc378de7c..212fcf357 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1288,9 +1288,11 @@ void SelectionVerb::perform(SPAction *action, void *data) break; case SP_VERB_SELECTION_COMBINE: + selection->toCurves(true); selection->combine(); break; case SP_VERB_SELECTION_BREAK_APART: + selection->toCurves(true); selection->breakApart(); break; case SP_VERB_SELECTION_ARRANGE: -- cgit v1.2.3 From 50322af6af4f0345d19e5ee224d5faedd1fce711 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sat, 9 Dec 2017 10:31:37 +0100 Subject: Fix typos --- src/ui/dialog/inkscape-preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index dcc3033fa..f1129513f 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1397,7 +1397,7 @@ void InkscapePreferences::initPageBehavior() _page_clones.add_group_header( _("Unlinking clones")); _clone_to_curves.init ( _("Path operations unlink clones"), "/options/pathoperationsunlink/value", true); _page_clones.add_line(true, "", _clone_to_curves, "", - _("The following path operations will unlink clones: Stroke to path, Object to Path, Boolean operations, Combine and Break Apart")); + _("The following path operations will unlink clones: Stroke to path, Object to path, Boolean operations, Combine, Break apart")); //TRANSLATORS: Heading for the Inkscape Preferences "Clones" Page this->AddPage(_page_clones, _("Clones"), iter_behavior, PREFS_PAGE_BEHAVIOR_CLONES); -- cgit v1.2.3