From 73f078b27b669c941651ecf14a3119ae491ccabf Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 13 Jun 2016 00:58:55 +0200 Subject: Fix 90% of tweenk review (bzr r13645.1.155) --- src/live_effects/effect.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 0a78b199e..f60d628f6 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -400,19 +400,39 @@ Effect::doOnApply (SPLPEItem const*/*lpeitem*/) } void -Effect::setSelectedNodePoints(std::vector sNP) +Effect::setCurrentZoom(double cZ) { - selectedNodesPoints = sNP; + current_zoom = cZ; } void -Effect::setCurrentZoom(double cZ) +Effect::setSelectedNodePoints(std::vector selected_node_points) { - current_zoom = cZ; + selectedNodesPoints = selected_node_points; } +std::vector +Effect::getSelectedNodes() +{ + size_t counter = 0; + std::vector result; + for (size_t i = 0; i < pathvector_before_effect.size(); i++) { + for (size_t j = 0; j < pathvector_before_effect[i].size_closed(); j++) { + if ((pathvector_before_effect[i].size_closed() == j-1 && + isNodePointSelected( pathvector_before_effect[i][j].finalPoint())) || + isNodePointSelected( pathvector_before_effect[i][j].initialPoint())) + { + result.push_back(counter); + } + counter++; + } + } + return result; +} + + bool -Effect::isNodePointSelected(Geom::Point const &nodePoint) const +Effect::isNodePointSelected(Geom::Point const &node_point) const { if (selectedNodesPoints.size() > 0) { using Geom::X; @@ -421,7 +441,7 @@ Effect::isNodePointSelected(Geom::Point const &nodePoint) const i != selectedNodesPoints.end(); ++i) { Geom::Point p = *i; Geom::Affine transformCoordinate = sp_lpe_item->i2dt_affine(); - Geom::Point p2(nodePoint[X],nodePoint[Y]); + Geom::Point p2(node_point[X],node_point[Y]); p2 *= transformCoordinate; if (Geom::are_near(p, p2, 0.01)) { return true; -- cgit v1.2.3 From c5f642fbd66ccb150d361d2861d0b1baa744dcba Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 18 Jun 2016 15:07:51 +0200 Subject: Pre fixing selected points (bzr r13645.1.161) --- src/live_effects/effect.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index f60d628f6..515aa26fc 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -406,9 +406,9 @@ Effect::setCurrentZoom(double cZ) } void -Effect::setSelectedNodePoints(std::vector selected_node_points) +Effect::setSelectedNodePoints(std::vector selected_nodes_pos) { - selectedNodesPoints = selected_node_points; + _selected_nodes_pos = selected_nodes_pos; } std::vector @@ -418,7 +418,8 @@ Effect::getSelectedNodes() std::vector result; for (size_t i = 0; i < pathvector_before_effect.size(); i++) { for (size_t j = 0; j < pathvector_before_effect[i].size_closed(); j++) { - if ((pathvector_before_effect[i].size_closed() == j-1 && + if ((!pathvector_before_effect[i].closed() && + pathvector_before_effect[i].size_closed() == j-1 && isNodePointSelected( pathvector_before_effect[i][j].finalPoint())) || isNodePointSelected( pathvector_before_effect[i][j].initialPoint())) { @@ -434,11 +435,11 @@ Effect::getSelectedNodes() bool Effect::isNodePointSelected(Geom::Point const &node_point) const { - if (selectedNodesPoints.size() > 0) { + if (_selected_nodes_pos.size() > 0) { using Geom::X; using Geom::Y; - for (std::vector::const_iterator i = selectedNodesPoints.begin(); - i != selectedNodesPoints.end(); ++i) { + for (std::vector::const_iterator i = _selected_nodes_pos.begin(); + i != _selected_nodes_pos.end(); ++i) { Geom::Point p = *i; Geom::Affine transformCoordinate = sp_lpe_item->i2dt_affine(); Geom::Point p2(node_point[X],node_point[Y]); -- cgit v1.2.3 From 38a1a4d45114a681408e763c3afec79f0bc21940 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 18 Jun 2016 18:53:51 +0200 Subject: fixing bug moving nodes (bzr r13645.1.162) --- src/live_effects/effect.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 515aa26fc..7b36e30f9 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -363,14 +363,13 @@ Effect::Effect(LivePathEffectObject *lpeobject) lpeobj(lpeobject), concatenate_before_pwd2(false), sp_lpe_item(NULL), - current_zoom(1), sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden - is_ready(false) // is automatically set to false if providesOwnFlashPaths() is not overridden + is_ready(false), // is automatically set to false if providesOwnFlashPaths() is not overridden + _current_zoom(1.0) { registerParameter( dynamic_cast(&is_visible) ); is_visible.widget_is_visible = false; - current_zoom = 0.0; } Effect::~Effect() @@ -400,13 +399,19 @@ Effect::doOnApply (SPLPEItem const*/*lpeitem*/) } void -Effect::setCurrentZoom(double cZ) +Effect::setCurrentZoom(double zoom) { - current_zoom = cZ; + _current_zoom = zoom; +} + +double +Effect::getCurrentZoom() +{ + return _current_zoom; } void -Effect::setSelectedNodePoints(std::vector selected_nodes_pos) +Effect::setSelectedNodes(std::vector selected_nodes_pos) { _selected_nodes_pos = selected_nodes_pos; } @@ -419,9 +424,9 @@ Effect::getSelectedNodes() for (size_t i = 0; i < pathvector_before_effect.size(); i++) { for (size_t j = 0; j < pathvector_before_effect[i].size_closed(); j++) { if ((!pathvector_before_effect[i].closed() && - pathvector_before_effect[i].size_closed() == j-1 && - isNodePointSelected( pathvector_before_effect[i][j].finalPoint())) || - isNodePointSelected( pathvector_before_effect[i][j].initialPoint())) + pathvector_before_effect[i].size_closed() == j+1 && + isNodeSelected( pathvector_before_effect[i][j].finalPoint())) || + isNodeSelected( pathvector_before_effect[i][j].initialPoint())) { result.push_back(counter); } @@ -433,15 +438,15 @@ Effect::getSelectedNodes() bool -Effect::isNodePointSelected(Geom::Point const &node_point) const +Effect::isNodeSelected(Geom::Point const &node_point) const { if (_selected_nodes_pos.size() > 0) { using Geom::X; using Geom::Y; + Geom::Affine transformCoordinate = sp_lpe_item->i2dt_affine(); for (std::vector::const_iterator i = _selected_nodes_pos.begin(); i != _selected_nodes_pos.end(); ++i) { Geom::Point p = *i; - Geom::Affine transformCoordinate = sp_lpe_item->i2dt_affine(); Geom::Point p2(node_point[X],node_point[Y]); p2 *= transformCoordinate; if (Geom::are_near(p, p2, 0.01)) { -- cgit v1.2.3 From 6820ee49d69cd419c5e8d3c9de74b0552758c842 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 19 Jun 2016 00:58:42 +0200 Subject: Fixes when moves a path (bzr r13645.1.163) --- src/live_effects/effect.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 7b36e30f9..5ac5e2407 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -421,6 +421,9 @@ Effect::getSelectedNodes() { size_t counter = 0; std::vector result; + if (pathvector_before_effect.empty()){ + return result; + } for (size_t i = 0; i < pathvector_before_effect.size(); i++) { for (size_t j = 0; j < pathvector_before_effect[i].size_closed(); j++) { if ((!pathvector_before_effect[i].closed() && @@ -440,15 +443,11 @@ Effect::getSelectedNodes() bool Effect::isNodeSelected(Geom::Point const &node_point) const { - if (_selected_nodes_pos.size() > 0) { - using Geom::X; - using Geom::Y; - Geom::Affine transformCoordinate = sp_lpe_item->i2dt_affine(); + if (!_selected_nodes_pos.empty()) { for (std::vector::const_iterator i = _selected_nodes_pos.begin(); i != _selected_nodes_pos.end(); ++i) { - Geom::Point p = *i; - Geom::Point p2(node_point[X],node_point[Y]); - p2 *= transformCoordinate; + Geom::Point p = (*i); + Geom::Point p2(node_point[Geom::X],node_point[Geom::Y]); if (Geom::are_near(p, p2, 0.01)) { return true; } -- cgit v1.2.3 From e7afb49bd67284227bf5df1df22f9993b1bfa581 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 21 Jul 2016 21:05:55 +0200 Subject: =?UTF-8?q?This=20for=20you=20CR=20=C2=B7=20Measure=20line,=20show?= =?UTF-8?q?=20the=20distance=20on=20rect=20lines=20CAD=20like=20with=20aut?= =?UTF-8?q?o=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (bzr r15017.1.1) --- src/live_effects/effect.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 1868ca43b..d01312ca7 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -40,6 +40,7 @@ #include "live_effects/lpe-lattice2.h" #include "live_effects/lpe-lattice.h" #include "live_effects/lpe-line_segment.h" +#include "live_effects/lpe-measure-line.h" #include "live_effects/lpe-mirror_symmetry.h" #include "live_effects/lpe-offset.h" #include "live_effects/lpe-parallel.h" @@ -151,6 +152,8 @@ const Util::EnumData LPETypeData[] = { {FILL_BETWEEN_MANY, N_("Fill between many"), "fill_between_many"}, {ELLIPSE_5PTS, N_("Ellipse by 5 points"), "ellipse_5pts"}, {BOUNDING_BOX, N_("Bounding Box"), "bounding_box"}, +/* 9.93 */ + {MEASURE_LINE, N_("Measure Line"), "measure-line"}, }; const Util::EnumDataConverter LPETypeConverter(LPETypeData, sizeof(LPETypeData)/sizeof(*LPETypeData)); @@ -319,6 +322,9 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj) case TRANSFORM_2PTS: neweffect = static_cast ( new LPETransform2Pts(lpeobj) ); break; + case MEASURE_LINE: + neweffect = static_cast ( new LPEMeasureLine(lpeobj) ); + break; default: g_warning("LivePathEffect::Effect::New called with invalid patheffect type (%d)", lpenr); neweffect = NULL; -- cgit v1.2.3 From a5d6c9a27683820be3d84eea73c2d6f161ce0e8e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 24 Jul 2016 18:49:11 +0200 Subject: Add Text tag and update widgets code (bzr r15017.1.2) --- src/live_effects/effect.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index d01312ca7..a62e8b62b 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -370,6 +370,7 @@ Effect::Effect(LivePathEffectObject *lpeobject) concatenate_before_pwd2(false), sp_lpe_item(NULL), current_zoom(1), + upd_params(true), sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden is_ready(false) // is automatically set to false if providesOwnFlashPaths() is not overridden @@ -697,7 +698,7 @@ Effect::newWidget() ++it; } - + upd_params = false; return dynamic_cast(vbox); } -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/live_effects/effect.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 1868ca43b..ef807d586 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -8,12 +8,11 @@ //#define LPE_ENABLE_TEST_EFFECTS //uncomment for toy effects #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif // include effects: #include "live_effects/lpe-patternalongpath.h" -#include "live_effects/effect.h" #include "live_effects/lpe-angle_bisector.h" #include "live_effects/lpe-attach-path.h" #include "live_effects/lpe-bendpath.h" @@ -64,30 +63,14 @@ #include "live_effects/lpe-vonkoch.h" #include "xml/node-event-vector.h" -#include "sp-object.h" -#include "attributes.h" #include "message-stack.h" -#include "desktop.h" -#include "inkscape.h" -#include "document.h" #include "document-private.h" -#include "xml/document.h" -#include #include "ui/tools/pen-tool.h" #include "ui/tools-switch.h" #include "knotholder.h" -#include "sp-lpe-item.h" #include "live_effects/lpeobject.h" -#include "live_effects/parameter/parameter.h" -#include #include "display/curve.h" -#include - -#include <2geom/sbasis-to-bezier.h> -#include <2geom/affine.h> -#include <2geom/pathvector.h> - namespace Inkscape { -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/live_effects/effect.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index ef807d586..1868ca43b 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -8,11 +8,12 @@ //#define LPE_ENABLE_TEST_EFFECTS //uncomment for toy effects #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif // include effects: #include "live_effects/lpe-patternalongpath.h" +#include "live_effects/effect.h" #include "live_effects/lpe-angle_bisector.h" #include "live_effects/lpe-attach-path.h" #include "live_effects/lpe-bendpath.h" @@ -63,14 +64,30 @@ #include "live_effects/lpe-vonkoch.h" #include "xml/node-event-vector.h" +#include "sp-object.h" +#include "attributes.h" #include "message-stack.h" +#include "desktop.h" +#include "inkscape.h" +#include "document.h" #include "document-private.h" +#include "xml/document.h" +#include #include "ui/tools/pen-tool.h" #include "ui/tools-switch.h" #include "knotholder.h" +#include "sp-lpe-item.h" #include "live_effects/lpeobject.h" +#include "live_effects/parameter/parameter.h" +#include #include "display/curve.h" +#include + +#include <2geom/sbasis-to-bezier.h> +#include <2geom/affine.h> +#include <2geom/pathvector.h> + namespace Inkscape { -- cgit v1.2.3 From 7f16afbb515eceed9c63afacec73cd528a662327 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 30 Jul 2016 19:04:34 +0200 Subject: Full rewrite on working mode now no linked paths necesary (bzr r15017.1.15) --- src/live_effects/effect.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index a62e8b62b..7efc1a711 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -454,7 +454,9 @@ void Effect::doAfterEffect (SPLPEItem const* /*lpeitem*/) void Effect::doOnRemove (SPLPEItem const* /*lpeitem*/) { } - +void Effect::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/) +{ +} //secret impl methods (shhhh!) void Effect::doOnApply_impl(SPLPEItem const* lpeitem) { -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/live_effects/effect.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 1868ca43b..ef807d586 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -8,12 +8,11 @@ //#define LPE_ENABLE_TEST_EFFECTS //uncomment for toy effects #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif // include effects: #include "live_effects/lpe-patternalongpath.h" -#include "live_effects/effect.h" #include "live_effects/lpe-angle_bisector.h" #include "live_effects/lpe-attach-path.h" #include "live_effects/lpe-bendpath.h" @@ -64,30 +63,14 @@ #include "live_effects/lpe-vonkoch.h" #include "xml/node-event-vector.h" -#include "sp-object.h" -#include "attributes.h" #include "message-stack.h" -#include "desktop.h" -#include "inkscape.h" -#include "document.h" #include "document-private.h" -#include "xml/document.h" -#include #include "ui/tools/pen-tool.h" #include "ui/tools-switch.h" #include "knotholder.h" -#include "sp-lpe-item.h" #include "live_effects/lpeobject.h" -#include "live_effects/parameter/parameter.h" -#include #include "display/curve.h" -#include - -#include <2geom/sbasis-to-bezier.h> -#include <2geom/affine.h> -#include <2geom/pathvector.h> - namespace Inkscape { -- cgit v1.2.3 From e1a84ff6c44588f7847258b5eb5266365e0738e1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 15:27:55 +0200 Subject: Fixes to helper paths. evaluate backport to 0.92.x (bzr r15086) --- src/live_effects/effect.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index ef807d586..033eb8955 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -66,6 +66,7 @@ #include "message-stack.h" #include "document-private.h" #include "ui/tools/pen-tool.h" +#include "ui/tools/node-tool.h" #include "ui/tools-switch.h" #include "knotholder.h" #include "live_effects/lpeobject.h" @@ -454,6 +455,7 @@ void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) sp_lpe_item->apply_to_clippath(sp_lpe_item); sp_lpe_item->apply_to_mask(sp_lpe_item); } + update_helperpath(); } /** @@ -643,6 +645,17 @@ Effect::addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector(desktop->event_context); + nt->update_helperpath(); + } + } +} /** * This *creates* a new widget, management of deletion should be done by the caller -- cgit v1.2.3 From 3a70c702b97414c4508c6871462d1fa4f1433ad7 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 18:15:30 +0200 Subject: Add comment and fix in helper paths (bzr r15087) --- src/live_effects/effect.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 033eb8955..fd1b8e3ec 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -645,6 +645,9 @@ Effect::addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector Date: Mon, 29 Aug 2016 18:26:57 +0200 Subject: Fix some comment typos (bzr r15088) --- src/live_effects/effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index fd1b8e3ec..007a8ca38 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -646,7 +646,7 @@ Effect::addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector Date: Sat, 3 Dec 2016 20:05:32 +0100 Subject: Improvements and fixes for buds pointed by suv on measure line LPE (bzr r15294) --- src/live_effects/effect.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 792bb5d7a..41b7d8c2c 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -350,6 +350,7 @@ Effect::Effect(LivePathEffectObject *lpeobject) oncanvasedit_it(0), is_visible(_("Is visible?"), _("If unchecked, the effect remains applied to the object but is temporarily disabled on canvas"), "is_visible", &wr, this, true), show_orig_path(false), + erase_extra_objects(true), lpeobj(lpeobject), concatenate_before_pwd2(false), sp_lpe_item(NULL), -- cgit v1.2.3 From 5ba49eaa5621b2e232f8df179798a1b2b282890c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 19 Dec 2016 19:00:54 +0100 Subject: Add update_helperpaths not member of nodetool class to easy call from outside (bzr r15335) --- src/live_effects/effect.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 41b7d8c2c..4458c3a20 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -660,14 +660,7 @@ Effect::addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector(desktop->event_context); - nt->update_helperpath(); - } - } + Inkscape::UI::Tools::sp_update_helperpath(); } /** -- cgit v1.2.3 From 952eb10b1e00f0e4abfbf8dd23fcb3935019f098 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Mon, 19 Dec 2016 21:54:42 +0100 Subject: Remove some ocurrences of desktop in knot functions (bzr r15337) --- src/live_effects/effect.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 4458c3a20..5cc0d6f20 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -612,15 +612,15 @@ Effect::registerParameter(Parameter * param) * Add all registered LPE knotholder handles to the knotholder */ void -Effect::addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { +Effect::addHandles(KnotHolder *knotholder, SPItem *item) { using namespace Inkscape::LivePathEffect; // add handles provided by the effect itself - addKnotHolderEntities(knotholder, desktop, item); + addKnotHolderEntities(knotholder, item); // add handles provided by the effect's parameters (if any) for (std::vector::iterator p = param_vector.begin(); p != param_vector.end(); ++p) { - (*p)->addKnotHolderEntities(knotholder, desktop, item); + (*p)->addKnotHolderEntities(knotholder, item); } } -- cgit v1.2.3 From 50714133d92da517b5185385ea4c553408c80e54 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Wed, 28 Dec 2016 09:42:19 +0100 Subject: First attemp working (bzr r15356.1.1) --- src/live_effects/effect.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 5cc0d6f20..cfd393b87 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -116,7 +116,7 @@ const Util::EnumData LPETypeData[] = { {RULER, N_("Ruler"), "ruler"}, /* 0.91 */ {POWERSTROKE, N_("Power stroke"), "powerstroke"}, - {CLONE_ORIGINAL, N_("Clone original path"), "clone_original"}, + {CLONE_ORIGINAL, N_("Clone original"), "clone_original"}, /* 0.92 */ {SIMPLIFY, N_("Simplify"), "simplify"}, {LATTICE2, N_("Lattice Deformation 2"), "lattice2"}, @@ -457,8 +457,7 @@ void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) //printf("(SPLPEITEM*) %p\n", sp_lpe_item); SPShape * shape = dynamic_cast(sp_lpe_item); if(shape){ - sp_curve = shape->getCurve(); - pathvector_before_effect = sp_curve->get_pathvector(); + setSPCurve(shape->getCurve()); } doBeforeEffect(lpeitem); if (apply_to_clippath_and_mask && SP_IS_GROUP(sp_lpe_item)) { @@ -468,6 +467,11 @@ void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) update_helperpath(); } +void Effect::setSPCurve(SPCurve *curve) +{ + sp_curve = curve; + pathvector_before_effect = curve->get_pathvector(); +} /** * Effects can have a parameter path set before they are applied by accepting a nonzero number of * mouse clicks. This method activates the pen context, which waits for the specified number of -- cgit v1.2.3 From f69e17d45c7311cb8430caa03f4f41be63ac9279 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Thu, 29 Dec 2016 21:32:45 +0100 Subject: Add sp_shape to LPE chain and fixing transforms (bzr r15356.1.4) --- src/live_effects/effect.cpp | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index cfd393b87..81a512d23 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -356,7 +356,7 @@ Effect::Effect(LivePathEffectObject *lpeobject) sp_lpe_item(NULL), current_zoom(1), upd_params(true), - sp_curve(NULL), + sp_shape(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden is_ready(false) // is automatically set to false if providesOwnFlashPaths() is not overridden { @@ -392,9 +392,9 @@ Effect::doOnApply (SPLPEItem const*/*lpeitem*/) } void -Effect::setSelectedNodePoints(std::vector sNP) +Effect::setSelectedNodePoints(std::vector selected_np) { - selectedNodesPoints = sNP; + selected_nodes_points = selected_np; } void @@ -404,16 +404,16 @@ Effect::setCurrentZoom(double cZ) } bool -Effect::isNodePointSelected(Geom::Point const &nodePoint) const +Effect::isNodePointSelected(Geom::Point const &node_point) const { - if (selectedNodesPoints.size() > 0) { + if (selected_nodes_points.size() > 0) { using Geom::X; using Geom::Y; - for (std::vector::const_iterator i = selectedNodesPoints.begin(); - i != selectedNodesPoints.end(); ++i) { + for (std::vector::const_iterator i = selected_nodes_points.begin(); + i != selected_nodes_points.end(); ++i) { Geom::Point p = *i; Geom::Affine transformCoordinate = sp_lpe_item->i2dt_affine(); - Geom::Point p2(nodePoint[X],nodePoint[Y]); + Geom::Point p2(node_point[X], node_point[Y]); p2 *= transformCoordinate; if (Geom::are_near(p, p2, 0.01)) { return true; @@ -446,20 +446,24 @@ void Effect::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/) void Effect::doOnApply_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast(lpeitem); - /*sp_curve = SP_SHAPE(sp_lpe_item)->getCurve(); - pathvector_before_effect = sp_curve->get_pathvector();*/ + SPShape * shape = dynamic_cast(sp_lpe_item); + if(shape){ + setCurrentShape(shape); + } doOnApply(lpeitem); } void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast(lpeitem); - //printf("(SPLPEITEM*) %p\n", sp_lpe_item); + //Groups set shape in performPathEffect before each call to doEffect SPShape * shape = dynamic_cast(sp_lpe_item); if(shape){ - setSPCurve(shape->getCurve()); + setCurrentShape(shape); } + //printf("(SPLPEITEM*) %p\n", sp_lpe_item); doBeforeEffect(lpeitem); + if (apply_to_clippath_and_mask && SP_IS_GROUP(sp_lpe_item)) { sp_lpe_item->apply_to_clippath(sp_lpe_item); sp_lpe_item->apply_to_mask(sp_lpe_item); @@ -467,10 +471,15 @@ void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) update_helperpath(); } -void Effect::setSPCurve(SPCurve *curve) -{ - sp_curve = curve; - pathvector_before_effect = curve->get_pathvector(); +void Effect::setCurrentShape(SPShape * shape){ + if(shape){ + sp_shape = shape; + if (!(sp_curve = sp_shape->getCurve())) { + // oops + return; + } + pathvector_before_effect = sp_curve->get_pathvector(); + } } /** * Effects can have a parameter path set before they are applied by accepting a nonzero number of -- cgit v1.2.3 From d431044fc72f9b668dcfa5771f361f4d6088bdd7 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sun, 22 Jan 2017 18:53:31 +0100 Subject: Update to new code in trunk (bzr r13645.1.166) --- src/live_effects/effect.cpp | 94 +++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 41 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 6899a3161..19e80c611 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -119,7 +119,7 @@ const Util::EnumData LPETypeData[] = { /* 0.92 */ {SIMPLIFY, N_("Simplify"), "simplify"}, {LATTICE2, N_("Lattice Deformation 2"), "lattice2"}, - {PERSPECTIVE_ENVELOPE, N_("Perspective/Envelope"), "perspective-envelope"}, + {PERSPECTIVE_ENVELOPE, N_("Perspective/Envelope"), "perspective_envelope"}, {INTERPOLATE_POINTS, N_("Interpolate points"), "interpolate_points"}, {TRANSFORM_2PTS, N_("Transform by 2 points"), "transform_2pts"}, {SHOW_HANDLES, N_("Show handles"), "show_handles"}, @@ -129,7 +129,6 @@ const Util::EnumData LPETypeData[] = { {TAPER_STROKE, N_("Taper stroke"), "taper_stroke"}, {MIRROR_SYMMETRY, N_("Mirror symmetry"), "mirror_symmetry"}, {COPY_ROTATE, N_("Rotate copies"), "copy_rotate"}, - {FILLET_CHAMFER, N_("Fillet/Chamfer"), "fillet-chamfer"}, /* Ponyscape -> Inkscape 0.92*/ {ATTACH_PATH, N_("Attach path"), "attach_path"}, {FILL_BETWEEN_STROKES, N_("Fill between strokes"), "fill_between_strokes"}, @@ -137,7 +136,8 @@ const Util::EnumData LPETypeData[] = { {ELLIPSE_5PTS, N_("Ellipse by 5 points"), "ellipse_5pts"}, {BOUNDING_BOX, N_("Bounding Box"), "bounding_box"}, /* 9.93 */ - {MEASURE_LINE, N_("Measure Line"), "measure-line"}, + {MEASURE_LINE, N_("Measure Line"), "measure_line"}, + {FILLET_CHAMFER, N_("Fillet/Chamfer"), "fillet_chamfer"}, }; const Util::EnumDataConverter LPETypeConverter(LPETypeData, sizeof(LPETypeData)/sizeof(*LPETypeData)); @@ -358,11 +358,11 @@ Effect::Effect(LivePathEffectObject *lpeobject) upd_params(true), sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden - is_ready(false), // is automatically set to false if providesOwnFlashPaths() is not overridden - _current_zoom(1.0) + is_ready(false) // is automatically set to false if providesOwnFlashPaths() is not overridden { registerParameter( dynamic_cast(&is_visible) ); is_visible.widget_is_visible = false; + current_zoom = 0.0; } Effect::~Effect() @@ -392,55 +392,67 @@ Effect::doOnApply (SPLPEItem const*/*lpeitem*/) } void -Effect::setCurrentZoom(double zoom) +Effect::setSelectedNodePos(std::vector selected_nodes_pos_data) { - _current_zoom = zoom; -} - -double -Effect::getCurrentZoom() -{ - return _current_zoom; + selected_nodes_pos = selected_nodes_pos_data; } void -Effect::setSelectedNodes(std::vector selected_nodes_pos) +Effect::setSelectedNodeIndex(Geom::PathVector pv) { - _selected_nodes_pos = selected_nodes_pos; -} + selected_nodes_index.clear(); + for (Geom::PathVector::const_iterator path_it = pv.begin(); + path_it != pv.end(); ++path_it) { -std::vector -Effect::getSelectedNodes() -{ - size_t counter = 0; - std::vector result; - if (pathvector_before_effect.empty()){ - return result; - } - for (size_t i = 0; i < pathvector_before_effect.size(); i++) { - for (size_t j = 0; j < pathvector_before_effect[i].size_closed(); j++) { - if ((!pathvector_before_effect[i].closed() && - pathvector_before_effect[i].size_closed() == j+1 && - isNodeSelected( pathvector_before_effect[i][j].finalPoint())) || - isNodeSelected( pathvector_before_effect[i][j].initialPoint())) - { - result.push_back(counter); + if (path_it->empty()) { + continue; + } + Geom::Path::const_iterator curve_it1 = path_it->begin(); + Geom::Path::const_iterator curve_endit = path_it->end_default(); + if (path_it->closed()) { + const Geom::Curve &closingline = path_it->back_closed(); + // the closing line segment is always of type + // Geom::LineSegment. + if (are_near(closingline.initialPoint(), closingline.finalPoint())) { + // closingline.isDegenerate() did not work, because it only checks for + // *exact* zero length, which goes wrong for relative coordinates and + // rounding errors... + // the closing line segment has zero-length. So stop before that one! + curve_endit = path_it->end_open(); + } + } + size_t i = 0; + while (curve_it1 != curve_endit) { + if (isNodeSelected(curve_it1->initialPoint())) { + selected_nodes_index.push_back(i); } - counter++; + ++i; + ++curve_it1; + } + if (isNodeSelected(path_it->finalPoint())) { + selected_nodes_index.push_back(i); } } - return result; } +void +Effect::setCurrentZoom(double cZ) +{ + current_zoom = cZ; +} bool -Effect::isNodeSelected(Geom::Point const &node_point) const -{ - if (!_selected_nodes_pos.empty()) { - for (std::vector::const_iterator i = _selected_nodes_pos.begin(); - i != _selected_nodes_pos.end(); ++i) { - Geom::Point p = (*i); - Geom::Point p2(node_point[Geom::X],node_point[Geom::Y]); +Effect::isNodeSelected(Geom::Point const &nodePoint) const +{ + if (selected_nodes_pos.size() > 0) { + using Geom::X; + using Geom::Y; + for (std::vector::const_iterator i = selected_nodes_pos.begin(); + i != selected_nodes_pos.end(); ++i) { + Geom::Point p = *i; + Geom::Affine transformCoordinate = sp_lpe_item->i2dt_affine(); + Geom::Point p2(nodePoint[X],nodePoint[Y]); + p2 *= transformCoordinate; if (Geom::are_near(p, p2, 0.01)) { return true; } -- cgit v1.2.3 From ba053c48cdcd8b4995f188d80887d46c41f97b3d Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Tue, 24 Jan 2017 01:37:00 +0100 Subject: Remove some code and make dependant of rotate copies (bzr r15356.1.17) --- src/live_effects/effect.cpp | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 81a512d23..9d9381294 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -356,7 +356,7 @@ Effect::Effect(LivePathEffectObject *lpeobject) sp_lpe_item(NULL), current_zoom(1), upd_params(true), - sp_shape(NULL), + sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden is_ready(false) // is automatically set to false if providesOwnFlashPaths() is not overridden { @@ -392,9 +392,9 @@ Effect::doOnApply (SPLPEItem const*/*lpeitem*/) } void -Effect::setSelectedNodePoints(std::vector selected_np) +Effect::setSelectedNodePoints(std::vector sNP) { - selected_nodes_points = selected_np; + selectedNodesPoints = sNP; } void @@ -404,16 +404,16 @@ Effect::setCurrentZoom(double cZ) } bool -Effect::isNodePointSelected(Geom::Point const &node_point) const +Effect::isNodePointSelected(Geom::Point const &nodePoint) const { - if (selected_nodes_points.size() > 0) { + if (selectedNodesPoints.size() > 0) { using Geom::X; using Geom::Y; - for (std::vector::const_iterator i = selected_nodes_points.begin(); - i != selected_nodes_points.end(); ++i) { + for (std::vector::const_iterator i = selectedNodesPoints.begin(); + i != selectedNodesPoints.end(); ++i) { Geom::Point p = *i; Geom::Affine transformCoordinate = sp_lpe_item->i2dt_affine(); - Geom::Point p2(node_point[X], node_point[Y]); + Geom::Point p2(nodePoint[X],nodePoint[Y]); p2 *= transformCoordinate; if (Geom::are_near(p, p2, 0.01)) { return true; @@ -446,24 +446,21 @@ void Effect::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/) void Effect::doOnApply_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast(lpeitem); - SPShape * shape = dynamic_cast(sp_lpe_item); - if(shape){ - setCurrentShape(shape); - } + /*sp_curve = SP_SHAPE(sp_lpe_item)->getCurve(); + pathvector_before_effect = sp_curve->get_pathvector();*/ doOnApply(lpeitem); } void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast(lpeitem); - //Groups set shape in performPathEffect before each call to doEffect + //printf("(SPLPEITEM*) %p\n", sp_lpe_item); SPShape * shape = dynamic_cast(sp_lpe_item); if(shape){ - setCurrentShape(shape); + sp_curve = shape->getCurve(); + pathvector_before_effect = sp_curve->get_pathvector(); } - //printf("(SPLPEITEM*) %p\n", sp_lpe_item); doBeforeEffect(lpeitem); - if (apply_to_clippath_and_mask && SP_IS_GROUP(sp_lpe_item)) { sp_lpe_item->apply_to_clippath(sp_lpe_item); sp_lpe_item->apply_to_mask(sp_lpe_item); @@ -471,16 +468,6 @@ void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) update_helperpath(); } -void Effect::setCurrentShape(SPShape * shape){ - if(shape){ - sp_shape = shape; - if (!(sp_curve = sp_shape->getCurve())) { - // oops - return; - } - pathvector_before_effect = sp_curve->get_pathvector(); - } -} /** * Effects can have a parameter path set before they are applied by accepting a nonzero number of * mouse clicks. This method activates the pen context, which waits for the specified number of -- cgit v1.2.3 From 7fecbddd1fb8b57f9c6efd3204645e33d9b38d09 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 24 Jan 2017 10:32:24 +0100 Subject: update to trunk (bzr r15356.1.18) --- src/live_effects/effect.cpp | 88 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 6 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 9d9381294..50e2aa353 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -70,6 +70,8 @@ #include "ui/tools/node-tool.h" #include "ui/tools-switch.h" #include "knotholder.h" +#include "path-chemistry.h" +#include "xml/sp-css-attr.h" #include "live_effects/lpeobject.h" #include "display/curve.h" @@ -356,6 +358,7 @@ Effect::Effect(LivePathEffectObject *lpeobject) sp_lpe_item(NULL), current_zoom(1), upd_params(true), + sp_shape(NULL), sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden is_ready(false) // is automatically set to false if providesOwnFlashPaths() is not overridden @@ -392,15 +395,15 @@ Effect::doOnApply (SPLPEItem const*/*lpeitem*/) } void -Effect::setSelectedNodePoints(std::vector sNP) +Effect::setCurrentZoom(double cZ) { - selectedNodesPoints = sNP; + current_zoom = cZ; } void -Effect::setCurrentZoom(double cZ) +Effect::setSelectedNodePoints(std::vector sNP) { - current_zoom = cZ; + selectedNodesPoints = sNP; } bool @@ -423,6 +426,74 @@ Effect::isNodePointSelected(Geom::Point const &nodePoint) const return false; } +void +Effect::processObjects(LpeAction lpe_action) +{ + SPDocument * document = SP_ACTIVE_DOCUMENT; + for (std::vector::iterator el_it = items.begin(); + el_it != items.end(); ++el_it) { + const char * id = *el_it; + if (!id || strlen(id) == 0) { + return; + } + SPObject *elemref = NULL; + if (elemref = document->getObjectById(id)) { + Inkscape::XML::Node * elemnode = elemref->getRepr(); + std::vector item_list; + item_list.push_back(SP_ITEM(elemref)); + std::vector item_to_select; + std::vector item_selected; + SPCSSAttr *css; + Glib::ustring css_str; + switch (lpe_action){ + case LPE_TO_OBJECTS: + if (SP_ITEM(elemref)->isHidden()) { + elemref->deleteObject(); + } else { + if (elemnode->attribute("inkscape:path-effect")) { + sp_item_list_to_curves(item_list, item_selected, item_to_select); + } + elemnode->setAttribute("sodipodi:insensitive", NULL); + } + break; + + case LPE_ERASE: + elemref->deleteObject(); + break; + + case LPE_VISIBILITY: + css = sp_repr_css_attr_new(); + sp_repr_css_attr_add_from_string(css, elemref->getRepr()->attribute("style")); + if (!this->isVisible()/* && std::strcmp(elemref->getId(),sp_lpe_item->getId()) != 0*/) { + css->setAttribute("display", "none"); + } else { + css->setAttribute("display", NULL); + } + sp_repr_css_write_string(css,css_str); + elemnode->setAttribute("style", css_str.c_str()); + break; + + default: + break; + } + } + } + if (lpe_action == LPE_ERASE || lpe_action == LPE_TO_OBJECTS) { + items.clear(); + } +} + +void Effect::setCurrentShape(SPShape * shape){ + if(shape){ + sp_shape = shape; + if (!(sp_curve = sp_shape->getCurve())) { + // oops + return; + } + pathvector_before_effect = sp_curve->get_pathvector(); + } +} + /** * Is performed each time before the effect is updated. */ @@ -446,8 +517,12 @@ void Effect::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/) void Effect::doOnApply_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast(lpeitem); - /*sp_curve = SP_SHAPE(sp_lpe_item)->getCurve(); - pathvector_before_effect = sp_curve->get_pathvector();*/ + sp_curve = SP_SHAPE(sp_lpe_item)->getCurve(); + pathvector_before_effect = sp_curve->get_pathvector(); + SPShape * shape = dynamic_cast(sp_lpe_item); + if(shape){ + setCurrentShape(shape); + } doOnApply(lpeitem); } @@ -457,6 +532,7 @@ void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) //printf("(SPLPEITEM*) %p\n", sp_lpe_item); SPShape * shape = dynamic_cast(sp_lpe_item); if(shape){ + setCurrentShape(shape); sp_curve = shape->getCurve(); pathvector_before_effect = sp_curve->get_pathvector(); } -- cgit v1.2.3 From 50cff32bb7ab2fb2ab618ee5b3f4e31852e5802c Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sat, 18 Feb 2017 13:10:14 +0100 Subject: Fix bug 1665595 and prevent other LPE the same bug when using ACTIVE_DOCUMENT Fixed bugs: - https://launchpad.net/bugs/1665595 (bzr r15530) --- src/live_effects/effect.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 50e2aa353..f664870ec 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -430,6 +430,9 @@ void Effect::processObjects(LpeAction lpe_action) { SPDocument * document = SP_ACTIVE_DOCUMENT; + if (!document) { + return; + } for (std::vector::iterator el_it = items.begin(); el_it != items.end(); ++el_it) { const char * id = *el_it; -- cgit v1.2.3 From fdd8ce77fa742072a1cea8136acaeed1dae079b5 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Thu, 16 Mar 2017 23:29:49 +0100 Subject: Remove some compiling warns (bzr r15599) --- src/live_effects/effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index f664870ec..017947cda 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -440,7 +440,7 @@ Effect::processObjects(LpeAction lpe_action) return; } SPObject *elemref = NULL; - if (elemref = document->getObjectById(id)) { + if ((elemref = document->getObjectById(id))) { Inkscape::XML::Node * elemnode = elemref->getRepr(); std::vector item_list; item_list.push_back(SP_ITEM(elemref)); -- cgit v1.2.3 From 87e82106ab1ce4eb6c961c9332287594b1be8af3 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Fri, 28 Apr 2017 21:41:42 +0200 Subject: Formating code (bzr r15648) --- src/live_effects/effect.cpp | 103 ++++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 51 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 017947cda..bfcca422e 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -74,72 +74,73 @@ #include "xml/sp-css-attr.h" #include "live_effects/lpeobject.h" #include "display/curve.h" - +#include +#include namespace Inkscape { namespace LivePathEffect { - +const Glib::ustring DEFAULT_PREF_VALUE = "--default"; const Util::EnumData LPETypeData[] = { // {constant defined in effect-enum.h, N_("name of your effect"), "name of your effect in SVG"} #ifdef LPE_ENABLE_TEST_EFFECTS - {DOEFFECTSTACK_TEST, N_("doEffect stack test"), "doeffectstacktest"}, - {ANGLE_BISECTOR, N_("Angle bisector"), "angle_bisector"}, + {DOEFFECTSTACK_TEST, N_("doEffect stack test"), "doeffectstacktest"}, + {ANGLE_BISECTOR, N_("Angle bisector"), "angle_bisector"}, {CIRCLE_WITH_RADIUS, N_("Circle (by center and radius)"), "circle_with_radius"}, - {CIRCLE_3PTS, N_("Circle by 3 points"), "circle_3pts"}, - {DYNASTROKE, N_("Dynamic stroke"), "dynastroke"}, - {EXTRUDE, N_("Extrude"), "extrude"}, - {LATTICE, N_("Lattice Deformation"), "lattice"}, - {LINE_SEGMENT, N_("Line Segment"), "line_segment"}, - {OFFSET, N_("Offset"), "offset"}, - {PARALLEL, N_("Parallel"), "parallel"}, - {PATH_LENGTH, N_("Path length"), "path_length"}, - {PERP_BISECTOR, N_("Perpendicular bisector"), "perp_bisector"}, - {PERSPECTIVE_PATH, N_("Perspective path"), "perspective_path"}, - {RECURSIVE_SKELETON, N_("Recursive skeleton"), "recursive_skeleton"}, - {TANGENT_TO_CURVE, N_("Tangent to curve"), "tangent_to_curve"}, - {TEXT_LABEL, N_("Text label"), "text_label"}, - {FILLET_CHAMFER, N_("Fillet/Chamfer"), "fillet-chamfer"}, + {CIRCLE_3PTS, N_("Circle by 3 points"), "circle_3pts"}, + {DYNASTROKE, N_("Dynamic stroke"), "dynastroke"}, + {EXTRUDE, N_("Extrude"), "extrude"}, + {LATTICE, N_("Lattice Deformation"), "lattice"}, + {LINE_SEGMENT, N_("Line Segment"), "line_segment"}, + {OFFSET, N_("Offset"), "offset"}, + {PARALLEL, N_("Parallel"), "parallel"}, + {PATH_LENGTH, N_("Path length"), "path_length"}, + {PERP_BISECTOR, N_("Perpendicular bisector"), "perp_bisector"}, + {PERSPECTIVE_PATH, N_("Perspective path"), "perspective_path"}, + {RECURSIVE_SKELETON, N_("Recursive skeleton"), "recursive_skeleton"}, + {TANGENT_TO_CURVE, N_("Tangent to curve"), "tangent_to_curve"}, + {TEXT_LABEL, N_("Text label"), "text_label"}, + {FILLET_CHAMFER, N_("Fillet/Chamfer"), "fillet_chamfer"}, #endif /* 0.46 */ - {BEND_PATH, N_("Bend"), "bend_path"}, - {GEARS, N_("Gears"), "gears"}, - {PATTERN_ALONG_PATH, N_("Pattern Along Path"), "skeletal"}, // for historic reasons, this effect is called skeletal(strokes) in Inkscape:SVG - {CURVE_STITCH, N_("Stitch Sub-Paths"), "curvestitching"}, + {BEND_PATH, N_("Bend"), "bend_path"}, + {GEARS, N_("Gears"), "gears"}, + {PATTERN_ALONG_PATH, N_("Pattern Along Path"), "skeletal"}, // for historic reasons, this effect is called skeletal(strokes) in Inkscape:SVG + {CURVE_STITCH, N_("Stitch Sub-Paths"), "curvestitching"}, /* 0.47 */ - {VONKOCH, N_("VonKoch"), "vonkoch"}, - {KNOT, N_("Knot"), "knot"}, - {CONSTRUCT_GRID, N_("Construct grid"), "construct_grid"}, - {SPIRO, N_("Spiro spline"), "spiro"}, - {ENVELOPE, N_("Envelope Deformation"), "envelope"}, - {INTERPOLATE, N_("Interpolate Sub-Paths"), "interpolate"}, - {ROUGH_HATCHES, N_("Hatches (rough)"), "rough_hatches"}, - {SKETCH, N_("Sketch"), "sketch"}, - {RULER, N_("Ruler"), "ruler"}, + {VONKOCH, N_("VonKoch"), "vonkoch"}, + {KNOT, N_("Knot"), "knot"}, + {CONSTRUCT_GRID, N_("Construct grid"), "construct_grid"}, + {SPIRO, N_("Spiro spline"), "spiro"}, + {ENVELOPE, N_("Envelope Deformation"), "envelope"}, + {INTERPOLATE, N_("Interpolate Sub-Paths"), "interpolate"}, + {ROUGH_HATCHES, N_("Hatches (rough)"), "rough_hatches"}, + {SKETCH, N_("Sketch"), "sketch"}, + {RULER, N_("Ruler"), "ruler"}, /* 0.91 */ - {POWERSTROKE, N_("Power stroke"), "powerstroke"}, - {CLONE_ORIGINAL, N_("Clone original"), "clone_original"}, + {POWERSTROKE, N_("Power stroke"), "powerstroke"}, + {CLONE_ORIGINAL, N_("Clone original"), "clone_original"}, /* 0.92 */ - {SIMPLIFY, N_("Simplify"), "simplify"}, - {LATTICE2, N_("Lattice Deformation 2"), "lattice2"}, - {PERSPECTIVE_ENVELOPE, N_("Perspective/Envelope"), "perspective-envelope"}, - {INTERPOLATE_POINTS, N_("Interpolate points"), "interpolate_points"}, - {TRANSFORM_2PTS, N_("Transform by 2 points"), "transform_2pts"}, - {SHOW_HANDLES, N_("Show handles"), "show_handles"}, - {ROUGHEN, N_("Roughen"), "roughen"}, - {BSPLINE, N_("BSpline"), "bspline"}, - {JOIN_TYPE, N_("Join type"), "join_type"}, - {TAPER_STROKE, N_("Taper stroke"), "taper_stroke"}, - {MIRROR_SYMMETRY, N_("Mirror symmetry"), "mirror_symmetry"}, - {COPY_ROTATE, N_("Rotate copies"), "copy_rotate"}, + {SIMPLIFY, N_("Simplify"), "simplify"}, + {LATTICE2, N_("Lattice Deformation 2"), "lattice2"}, + {PERSPECTIVE_ENVELOPE, N_("Perspective/Envelope"), "perspective-envelope"}, //TODO:Wrong name with "-" + {INTERPOLATE_POINTS, N_("Interpolate points"), "interpolate_points"}, + {TRANSFORM_2PTS, N_("Transform by 2 points"), "transform_2pts"}, + {SHOW_HANDLES, N_("Show handles"), "show_handles"}, + {ROUGHEN, N_("Roughen"), "roughen"}, + {BSPLINE, N_("BSpline"), "bspline"}, + {JOIN_TYPE, N_("Join type"), "join_type"}, + {TAPER_STROKE, N_("Taper stroke"), "taper_stroke"}, + {MIRROR_SYMMETRY, N_("Mirror symmetry"), "mirror_symmetry"}, + {COPY_ROTATE, N_("Rotate copies"), "copy_rotate"}, /* Ponyscape -> Inkscape 0.92*/ - {ATTACH_PATH, N_("Attach path"), "attach_path"}, - {FILL_BETWEEN_STROKES, N_("Fill between strokes"), "fill_between_strokes"}, - {FILL_BETWEEN_MANY, N_("Fill between many"), "fill_between_many"}, - {ELLIPSE_5PTS, N_("Ellipse by 5 points"), "ellipse_5pts"}, - {BOUNDING_BOX, N_("Bounding Box"), "bounding_box"}, + {ATTACH_PATH, N_("Attach path"), "attach_path"}, + {FILL_BETWEEN_STROKES, N_("Fill between strokes"), "fill_between_strokes"}, + {FILL_BETWEEN_MANY, N_("Fill between many"), "fill_between_many"}, + {ELLIPSE_5PTS, N_("Ellipse by 5 points"), "ellipse_5pts"}, + {BOUNDING_BOX, N_("Bounding Box"), "bounding_box"}, /* 9.93 */ - {MEASURE_LINE, N_("Measure Line"), "measure-line"}, + {MEASURE_LINE, N_("Measure Line"), "measure_line"}, }; const Util::EnumDataConverter LPETypeConverter(LPETypeData, sizeof(LPETypeData)/sizeof(*LPETypeData)); -- cgit v1.2.3 From e5601e5e84df30c40d93271fd69cecd31391e309 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sat, 29 Apr 2017 02:01:22 +0200 Subject: Rewrite UX (bzr r15620.1.12) --- src/live_effects/effect.cpp | 102 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 4 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index bfcca422e..37694f32f 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -73,6 +73,7 @@ #include "path-chemistry.h" #include "xml/sp-css-attr.h" #include "live_effects/lpeobject.h" +#include #include "display/curve.h" #include #include @@ -80,7 +81,7 @@ namespace Inkscape { namespace LivePathEffect { -const Glib::ustring DEFAULT_PREF_VALUE = "--default"; + const Util::EnumData LPETypeData[] = { // {constant defined in effect-enum.h, N_("name of your effect"), "name of your effect in SVG"} #ifdef LPE_ENABLE_TEST_EFFECTS @@ -645,6 +646,7 @@ void Effect::readallParameters(Inkscape::XML::Node const* repr) { std::vector::iterator it = param_vector.begin(); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); while (it != param_vector.end()) { Parameter * param = *it; const gchar * key = param->param_key.c_str(); @@ -655,10 +657,17 @@ Effect::readallParameters(Inkscape::XML::Node const* repr) g_warning("Effect::readallParameters - '%s' not accepted for %s", value, key); } } else { - // set default value - param->param_set_default(); + Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + + (Glib::ustring)LPETypeConverter.get_key(effectType()).c_str() + + (Glib::ustring)"/" + + (Glib::ustring)key; + bool valid = prefs->getEntry(pref_path).isValid(); + if(valid){ + param->param_update_default(prefs->getString(pref_path).c_str()); + } else { + param->param_set_default(); + } } - ++it; } } @@ -777,6 +786,91 @@ Effect::newWidget() return dynamic_cast(vbox); } +/** + * This *creates* a new widget, with default values setter + */ +Gtk::Widget * +Effect::defaultParamSet() +{ + // use manage here, because after deletion of Effect object, others might still be pointing to this widget. + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox() ); + + vbox->set_border_width(5); + Gtk::VBox * vbox_expander = Gtk::manage( new Gtk::VBox() ); + vbox_expander->set_border_width(10); + vbox_expander->set_spacing(2); + Glib::ustring effectname = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_label(effectType()); + Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(effectType()); + std::vector::iterator it = param_vector.begin(); + Inkscape::UI::Widget::Registry * wr; + while (it != param_vector.end()) { + if ((*it)->widget_is_visible) { + Parameter * param = *it; + Glib::ustring * tip = param->param_getTooltip(); + const gchar * key = param->param_key.c_str(); + const gchar * value = param->param_label.c_str(); + const gchar * tooltip_extra = _(". Change custom values for this parameter"); + Glib::ustring tooltip = param->param_tooltip + (Glib::ustring)tooltip_extra; + Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + + effectkey + + (Glib::ustring)"/" + + (Glib::ustring)key; + bool valid = prefs->getEntry(pref_path).isValid(); + const gchar * set_or_upd; + if (valid) { + set_or_upd = _("Update"); + } else { + set_or_upd = _("Set"); + } + Gtk::HBox * vbox_param = Gtk::manage( new Gtk::HBox(true) ); + Gtk::Label *parameter_label = Gtk::manage(new Gtk::Label(value, Gtk::ALIGN_START)); + parameter_label->set_use_markup(true); + parameter_label->set_use_underline (true); + parameter_label->set_ellipsize(Pango::ELLIPSIZE_END); + vbox_param->pack_start(*parameter_label, true, true, 2); + Gtk::Button *set = Gtk::manage(new Gtk::Button((Glib::ustring)set_or_upd)); + Gtk::Button *unset = Gtk::manage(new Gtk::Button(Glib::ustring(_("Unset")))); + unset->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &Effect::unsetDefaultParam), pref_path, set, unset)); + set->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &Effect::setDefaultParam), pref_path, param->param_getSVGValue(), set, unset)); + if (!valid) { + unset->set_sensitive(false); + } + vbox_param->pack_start(*set, true, true, 2); + vbox_param->pack_start(*unset, true, true, 2); + + vbox_expander->pack_start(*vbox_param, true, true, 2); + } + ++it; + } + Glib::ustring tip = "" + effectname + (Glib::ustring)_(": Set default parameters to current values"); + Gtk::Expander * expander = Gtk::manage(new Gtk::Expander(tip)); + expander->set_use_markup(true); + expander->add(*vbox_expander); + expander->set_expanded(false); + vbox->pack_start(*dynamic_cast (expander), true, true, 2); + return dynamic_cast(vbox); +} + +void +Effect::setDefaultParam(Glib::ustring pref_path, gchar * value, Gtk::Button *set , Gtk::Button *unset) +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setString(pref_path, (Glib::ustring)value); + gchar * label = _("Update"); + set->set_label((Glib::ustring)label); + unset->set_sensitive(true); +} + +void +Effect::unsetDefaultParam(Glib::ustring pref_path, Gtk::Button *set, Gtk::Button *unset) +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->remove(pref_path); + gchar * label = _("Set"); + set->set_label((Glib::ustring)label); + unset->set_sensitive(false); +} Inkscape::XML::Node *Effect::getRepr() { -- cgit v1.2.3 From a54924aece45764357c36d22d0475ef640b75ba1 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sat, 29 Apr 2017 16:40:51 +0200 Subject: minor bugfixing (bzr r15620.1.13) --- src/live_effects/effect.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 37694f32f..22cc5567b 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -795,17 +795,15 @@ Effect::defaultParamSet() // use manage here, because after deletion of Effect object, others might still be pointing to this widget. Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox() ); - - vbox->set_border_width(5); Gtk::VBox * vbox_expander = Gtk::manage( new Gtk::VBox() ); - vbox_expander->set_border_width(10); - vbox_expander->set_spacing(2); Glib::ustring effectname = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_label(effectType()); Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(effectType()); std::vector::iterator it = param_vector.begin(); Inkscape::UI::Widget::Registry * wr; + bool has_params = false; while (it != param_vector.end()) { if ((*it)->widget_is_visible) { + has_params = true; Parameter * param = *it; Glib::ustring * tip = param->param_getTooltip(); const gchar * key = param->param_key.c_str(); @@ -843,13 +841,17 @@ Effect::defaultParamSet() } ++it; } - Glib::ustring tip = "" + effectname + (Glib::ustring)_(": Set default parameters to current values"); + Glib::ustring tip = "" + effectname + (Glib::ustring)_(": Set default parameters"); Gtk::Expander * expander = Gtk::manage(new Gtk::Expander(tip)); expander->set_use_markup(true); expander->add(*vbox_expander); expander->set_expanded(false); vbox->pack_start(*dynamic_cast (expander), true, true, 2); - return dynamic_cast(vbox); + if (has_params) { + return dynamic_cast(vbox); + } else { + return NULL; + } } void -- cgit v1.2.3 From a3d1689c18ebf132acb7ae0501ec419a71e48a85 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Mon, 1 May 2017 03:15:26 +0200 Subject: Fix erase lpe in multi LPE mode Improve rendering widgets, simplify the code, redraw widgets each time not only on odd iterations (bzr r15655) --- src/live_effects/effect.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index bfcca422e..326225e0c 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -358,7 +358,6 @@ Effect::Effect(LivePathEffectObject *lpeobject) concatenate_before_pwd2(false), sp_lpe_item(NULL), current_zoom(1), - upd_params(true), sp_shape(NULL), sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden @@ -773,7 +772,6 @@ Effect::newWidget() ++it; } - upd_params = false; return dynamic_cast(vbox); } -- cgit v1.2.3 From 561ec7df77bc2e499dc525d987a8be4552e9ea41 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 5 May 2017 16:41:34 +0200 Subject: Improve responsive from LPE Fixed bugs: - https://launchpad.net/bugs/1688168 (bzr r15662) --- src/live_effects/effect.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 326225e0c..8df1aa927 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -358,6 +358,7 @@ Effect::Effect(LivePathEffectObject *lpeobject) concatenate_before_pwd2(false), sp_lpe_item(NULL), current_zoom(1), + upd_params(true), sp_shape(NULL), sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden -- cgit v1.2.3 From ae91bcdbb542c5e7233b0d33f8aba42439408587 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sun, 7 May 2017 02:23:42 +0200 Subject: Reorder LPE enum to match definition in effect.cpp. also fix a bug pointed by Ede_123 in IRC, LPE dialog show bad default selected LPE (bzr r15670) --- src/live_effects/effect.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 467a65c7c..6ab50b1c0 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -84,24 +84,6 @@ namespace LivePathEffect { const Util::EnumData LPETypeData[] = { // {constant defined in effect-enum.h, N_("name of your effect"), "name of your effect in SVG"} -#ifdef LPE_ENABLE_TEST_EFFECTS - {DOEFFECTSTACK_TEST, N_("doEffect stack test"), "doeffectstacktest"}, - {ANGLE_BISECTOR, N_("Angle bisector"), "angle_bisector"}, - {CIRCLE_WITH_RADIUS, N_("Circle (by center and radius)"), "circle_with_radius"}, - {CIRCLE_3PTS, N_("Circle by 3 points"), "circle_3pts"}, - {DYNASTROKE, N_("Dynamic stroke"), "dynastroke"}, - {EXTRUDE, N_("Extrude"), "extrude"}, - {LATTICE, N_("Lattice Deformation"), "lattice"}, - {LINE_SEGMENT, N_("Line Segment"), "line_segment"}, - {OFFSET, N_("Offset"), "offset"}, - {PARALLEL, N_("Parallel"), "parallel"}, - {PATH_LENGTH, N_("Path length"), "path_length"}, - {PERP_BISECTOR, N_("Perpendicular bisector"), "perp_bisector"}, - {PERSPECTIVE_PATH, N_("Perspective path"), "perspective_path"}, - {RECURSIVE_SKELETON, N_("Recursive skeleton"), "recursive_skeleton"}, - {TANGENT_TO_CURVE, N_("Tangent to curve"), "tangent_to_curve"}, - {TEXT_LABEL, N_("Text label"), "text_label"}, -#endif /* 0.46 */ {BEND_PATH, N_("Bend"), "bend_path"}, {GEARS, N_("Gears"), "gears"}, @@ -142,6 +124,25 @@ const Util::EnumData LPETypeData[] = { /* 9.93 */ {MEASURE_LINE, N_("Measure Line"), "measure_line"}, {FILLET_CHAMFER, N_("Fillet/Chamfer"), "fillet_chamfer"}, +#ifdef LPE_ENABLE_TEST_EFFECTS + {DOEFFECTSTACK_TEST, N_("doEffect stack test"), "doeffectstacktest"}, + {ANGLE_BISECTOR, N_("Angle bisector"), "angle_bisector"}, + {CIRCLE_WITH_RADIUS, N_("Circle (by center and radius)"), "circle_with_radius"}, + {CIRCLE_3PTS, N_("Circle by 3 points"), "circle_3pts"}, + {DYNASTROKE, N_("Dynamic stroke"), "dynastroke"}, + {EXTRUDE, N_("Extrude"), "extrude"}, + {LATTICE, N_("Lattice Deformation"), "lattice"}, + {LINE_SEGMENT, N_("Line Segment"), "line_segment"}, + {OFFSET, N_("Offset"), "offset"}, + {PARALLEL, N_("Parallel"), "parallel"}, + {PATH_LENGTH, N_("Path length"), "path_length"}, + {PERP_BISECTOR, N_("Perpendicular bisector"), "perp_bisector"}, + {PERSPECTIVE_PATH, N_("Perspective path"), "perspective_path"}, + {RECURSIVE_SKELETON, N_("Recursive skeleton"), "recursive_skeleton"}, + {TANGENT_TO_CURVE, N_("Tangent to curve"), "tangent_to_curve"}, + {TEXT_LABEL, N_("Text label"), "text_label"}, +#endif + }; const Util::EnumDataConverter LPETypeConverter(LPETypeData, sizeof(LPETypeData)/sizeof(*LPETypeData)); -- cgit v1.2.3 From d3deb9184f7044f930133f37654e52bc24272616 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sun, 7 May 2017 19:16:47 +0200 Subject: Fix a bug on tapper stroke detected with Ede_123 on IRC (bzr r15673) --- src/live_effects/effect.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 6ab50b1c0..aa8987185 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -492,7 +492,7 @@ Effect::processObjects(LpeAction lpe_action) void Effect::setCurrentShape(SPShape * shape){ if(shape){ sp_shape = shape; - if (!(sp_curve = sp_shape->getCurve())) { + if (!(sp_curve = sp_shape->getCurveBeforeLPE())) { // oops return; } @@ -523,25 +523,16 @@ void Effect::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/) void Effect::doOnApply_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast(lpeitem); - sp_curve = SP_SHAPE(sp_lpe_item)->getCurve(); - pathvector_before_effect = sp_curve->get_pathvector(); SPShape * shape = dynamic_cast(sp_lpe_item); - if(shape){ - setCurrentShape(shape); - } + setCurrentShape(shape); doOnApply(lpeitem); } void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast(lpeitem); - //printf("(SPLPEITEM*) %p\n", sp_lpe_item); SPShape * shape = dynamic_cast(sp_lpe_item); - if(shape){ - setCurrentShape(shape); - sp_curve = shape->getCurve(); - pathvector_before_effect = sp_curve->get_pathvector(); - } + setCurrentShape(shape); doBeforeEffect(lpeitem); if (apply_to_clippath_and_mask && SP_IS_GROUP(sp_lpe_item)) { sp_lpe_item->apply_to_clippath(sp_lpe_item); -- cgit v1.2.3 From 392fb78921ab50255888bc09e6b4252e71440370 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 26 May 2017 12:45:27 +0200 Subject: Improve methods on rotate copies LPE (bzr r15702) --- src/live_effects/effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index aa8987185..a4b44b1a9 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -439,7 +439,7 @@ Effect::processObjects(LpeAction lpe_action) for (std::vector::iterator el_it = items.begin(); el_it != items.end(); ++el_it) { const char * id = *el_it; - if (!id || strlen(id) == 0) { + if (!id) { return; } SPObject *elemref = NULL; -- cgit v1.2.3 From c98c541481381a04f5e04da046d457b05c3ed711 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sat, 27 May 2017 12:23:25 +0200 Subject: Change bad named vars (bzr r15704) --- src/live_effects/effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index a4b44b1a9..23a4c9f3d 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -355,7 +355,7 @@ Effect::Effect(LivePathEffectObject *lpeobject) oncanvasedit_it(0), is_visible(_("Is visible?"), _("If unchecked, the effect remains applied to the object but is temporarily disabled on canvas"), "is_visible", &wr, this, true), show_orig_path(false), - erase_extra_objects(true), + keep_paths(false), lpeobj(lpeobject), concatenate_before_pwd2(false), sp_lpe_item(NULL), -- cgit v1.2.3 From 59143c117378ec4a866f34b1ba2e2930bfb17593 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sun, 28 May 2017 12:46:10 +0200 Subject: Add a new value to LPE 'is_load' to know the lpe is just load, no previous values set yet to not LPE stored values when loading a previous file (bzr r15711) --- src/live_effects/effect.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 23a4c9f3d..3a628b243 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -356,6 +356,7 @@ Effect::Effect(LivePathEffectObject *lpeobject) is_visible(_("Is visible?"), _("If unchecked, the effect remains applied to the object but is temporarily disabled on canvas"), "is_visible", &wr, this, true), show_orig_path(false), keep_paths(false), + is_load(true), lpeobj(lpeobject), concatenate_before_pwd2(false), sp_lpe_item(NULL), @@ -511,6 +512,7 @@ Effect::doBeforeEffect (SPLPEItem const*/*lpeitem*/) void Effect::doAfterEffect (SPLPEItem const* /*lpeitem*/) { + is_load = false; } void Effect::doOnRemove (SPLPEItem const* /*lpeitem*/) -- cgit v1.2.3 From 5151c0569bb266461c3b6a6325c0d4be60b41a67 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Mon, 29 May 2017 02:09:29 +0200 Subject: Fix bug #1694111 also fixes noumerous bugfixes on LPE undo. And shapes are improved to only perform path effet one time each Fixed bugs: - https://launchpad.net/bugs/1694111 (bzr r15713) --- src/live_effects/effect.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 3a628b243..21136353c 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -452,10 +452,13 @@ Effect::processObjects(LpeAction lpe_action) std::vector item_selected; SPCSSAttr *css; Glib::ustring css_str; + SPItem *item = SP_ITEM(elemref); switch (lpe_action){ case LPE_TO_OBJECTS: - if (SP_ITEM(elemref)->isHidden()) { - elemref->deleteObject(); + if (item->isHidden()) { + sp_object_ref(item, 0 ); + item->deleteObject(true); + sp_object_unref(item); } else { if (elemnode->attribute("inkscape:path-effect")) { sp_item_list_to_curves(item_list, item_selected, item_to_select); @@ -465,7 +468,9 @@ Effect::processObjects(LpeAction lpe_action) break; case LPE_ERASE: - elemref->deleteObject(); + sp_object_ref(item, 0 ); + item->deleteObject(true); + sp_object_unref(item); break; case LPE_VISIBILITY: -- cgit v1.2.3