diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-11-05 18:30:49 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-11-05 18:30:49 +0000 |
| commit | f51e8d7c6b4e2caa9e470af674949f3cd1695bf5 (patch) | |
| tree | 2a733dbe915ff764ee9df8ac5840fa084c3f2ffc /src/live_effects/effect.cpp | |
| parent | Symbols. Fix for bug #1388910 (There is an unnecessary character in MapSymbol... (diff) | |
| download | inkscape-f51e8d7c6b4e2caa9e470af674949f3cd1695bf5.tar.gz inkscape-f51e8d7c6b4e2caa9e470af674949f3cd1695bf5.zip | |
Refactor to remove references to Desktop/Ui in Effect, bspline and fillet-chamfer.
Also fixed the selected node problem in units not px.
Also fixed two var to not allow NULL pointed by Johan Engelen.
(bzr r13672)
Diffstat (limited to 'src/live_effects/effect.cpp')
| -rw-r--r-- | src/live_effects/effect.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 1a64defd9..fbdc78f8a 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -75,8 +75,6 @@ #include <glibmm/i18n.h> #include "ui/tools/pen-tool.h" #include "ui/tools-switch.h" -#include "message-stack.h" -#include "desktop.h" #include "knotholder.h" #include "sp-lpe-item.h" #include "live_effects/lpeobject.h" @@ -370,6 +368,7 @@ Effect::Effect(LivePathEffectObject *lpeobject) { registerParameter( dynamic_cast<Parameter *>(&is_visible) ); is_visible.widget_is_visible = false; + current_zoom = 0.0; } Effect::~Effect() @@ -398,6 +397,36 @@ Effect::doOnApply (SPLPEItem const*/*lpeitem*/) { } +void +Effect::setSelectedNodePoints(std::vector<Geom::Point> sNP) +{ + selectedNodesPoints = sNP; +} + +void +Effect::setCurrentZoom(double cZ) +{ + current_zoom = cZ; +} + +bool +Effect::isNodePointSelected(Geom::Point const &nodePoint) const +{ + if (selectedNodesPoints.size() > 0) { + for (std::vector<Geom::Point>::const_iterator i = selectedNodesPoints.begin(); + i != selectedNodesPoints.end(); ++i) { + Geom::Point p = *i; + std::cout << p << "p\n"; + p[Geom::X] = Inkscape::Util::Quantity::convert(p[Geom::X], "px", *defaultUnit); + p[Geom::Y] = Inkscape::Util::Quantity::convert(p[Geom::Y], "px", *defaultUnit); + if (Geom::are_near(p, nodePoint, 0.01)) { + return true; + } + } + } + return false; +} + /** * Is performed each time before the effect is updated. */ @@ -419,6 +448,7 @@ void Effect::doOnRemove (SPLPEItem const* /*lpeitem*/) void Effect::doOnApply_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast<SPLPEItem *>(lpeitem); + defaultUnit = &sp_lpe_item->document->getDefaultUnit()->abbr; /*sp_curve = SP_SHAPE(sp_lpe_item)->getCurve(); pathvector_before_effect = sp_curve->get_pathvector();*/ doOnApply(lpeitem); @@ -427,6 +457,7 @@ void Effect::doOnApply_impl(SPLPEItem const* lpeitem) void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast<SPLPEItem *>(lpeitem); + defaultUnit = &sp_lpe_item->document->getDefaultUnit()->abbr; //printf("(SPLPEITEM*) %p\n", sp_lpe_item); sp_curve = SP_SHAPE(sp_lpe_item)->getCurve(); pathvector_before_effect = sp_curve->get_pathvector(); |
