diff options
| author | Ted Gould <ted@gould.cx> | 2010-07-13 20:16:51 +0000 |
|---|---|---|
| committer | Ted Gould <ted@gould.cx> | 2010-07-13 20:16:51 +0000 |
| commit | ef2d72d29fce61231bdd7888ab8330503158e9d6 (patch) | |
| tree | 4685bfddef010181fdd87fc182016b994f2b69d9 /src/live_effects | |
| parent | Pulling in a more recent trunk (diff) | |
| parent | Translations. Romanian nsh file update. (diff) | |
| download | inkscape-ef2d72d29fce61231bdd7888ab8330503158e9d6.tar.gz inkscape-ef2d72d29fce61231bdd7888ab8330503158e9d6.zip | |
Upgrading to trunk
(bzr r8254.1.57)
Diffstat (limited to 'src/live_effects')
| -rw-r--r-- | src/live_effects/effect.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/effect.h | 3 | ||||
| -rw-r--r-- | src/live_effects/lpe-angle_bisector.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-circle_3pts.cpp | 22 | ||||
| -rw-r--r-- | src/live_effects/lpe-circle_with_radius.cpp | 20 | ||||
| -rw-r--r-- | src/live_effects/lpe-constructgrid.cpp | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-curvestitch.cpp | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-extrude.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-gears.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-knot.cpp | 24 | ||||
| -rw-r--r-- | src/live_effects/lpeobject.cpp | 10 |
11 files changed, 35 insertions, 57 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index f761a6a7c..6266fade0 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -29,7 +29,7 @@ #include "message-stack.h" #include "desktop.h" #include "knotholder.h" - +#include "sp-lpe-item.h" #include "live_effects/lpeobject.h" #include "live_effects/parameter/parameter.h" #include <glibmm/ustring.h> diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index a8d34a233..681bae387 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -15,8 +15,6 @@ #include <glibmm/ustring.h> #include <2geom/forward.h> #include "ui/widget/registry.h" -#include "sp-lpe-item.h" -//#include "knotholder.h" #include "parameter/bool.h" #include "effect-enum.h" @@ -30,6 +28,7 @@ struct LivePathEffectObject; class SPLPEItem; class KnotHolder; class KnotHolderEntity; +class SPPath; namespace Gtk { class Widget; diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp index 71a34a1e2..aee4f48a1 100644 --- a/src/live_effects/lpe-angle_bisector.cpp +++ b/src/live_effects/lpe-angle_bisector.cpp @@ -25,6 +25,8 @@ #include <2geom/path.h> #include <2geom/sbasis-to-bezier.h> +#include "sp-lpe-item.h" + namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/lpe-circle_3pts.cpp b/src/live_effects/lpe-circle_3pts.cpp index d600ef046..951a3b7c8 100644 --- a/src/live_effects/lpe-circle_3pts.cpp +++ b/src/live_effects/lpe-circle_3pts.cpp @@ -17,6 +17,7 @@ // You might need to include other 2geom files. You can add them here: #include <2geom/path.h> +#include <2geom/circle.h> namespace Inkscape { namespace LivePathEffect { @@ -30,24 +31,6 @@ LPECircle3Pts::~LPECircle3Pts() { } -static void _circle(Geom::Point center, double radius, std::vector<Geom::Path> &path_out) { - using namespace Geom; - - Geom::Path pb; - - D2<SBasis> B; - Linear bo = Linear(0, 2 * M_PI); - - B[0] = cos(bo,4); - B[1] = sin(bo,4); - - B = B * radius + center; - - pb.append(SBasisCurve(B)); - - path_out.push_back(pb); -} - static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point const &C, std::vector<Geom::Path> &path_out) { using namespace Geom; @@ -64,7 +47,8 @@ static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point con Point M = D + v * lambda; double radius = L2(M - A); - _circle(M, radius, path_out); + Geom::Circle c(M, radius); + c.getPath(path_out); } std::vector<Geom::Path> diff --git a/src/live_effects/lpe-circle_with_radius.cpp b/src/live_effects/lpe-circle_with_radius.cpp index 574a9c004..71611e18b 100644 --- a/src/live_effects/lpe-circle_with_radius.cpp +++ b/src/live_effects/lpe-circle_with_radius.cpp @@ -18,6 +18,7 @@ #include <2geom/sbasis.h> #include <2geom/bezier-to-sbasis.h> #include <2geom/d2.h> +#include <2geom/circle.h> using namespace Geom; @@ -38,22 +39,6 @@ LPECircleWithRadius::~LPECircleWithRadius() } -void _circle(Geom::Point center, double radius, std::vector<Geom::Path> &path_out) { - Geom::Path pb; - - D2<SBasis> B; - Linear bo = Linear(0, 2 * M_PI); - - B[0] = cos(bo,4); - B[1] = sin(bo,4); - - B = B * radius + center; - - pb.append(SBasisCurve(B)); - - path_out.push_back(pb); -} - std::vector<Geom::Path> LPECircleWithRadius::doEffect_path (std::vector<Geom::Path> const & path_in) { @@ -64,7 +49,8 @@ LPECircleWithRadius::doEffect_path (std::vector<Geom::Path> const & path_in) double radius = Geom::L2(pt - center); - _circle(center, radius, path_out); + Geom::Circle c(center, radius); + c.getPath(path_out); return path_out; } diff --git a/src/live_effects/lpe-constructgrid.cpp b/src/live_effects/lpe-constructgrid.cpp index 4725573d7..4c6555f2d 100644 --- a/src/live_effects/lpe-constructgrid.cpp +++ b/src/live_effects/lpe-constructgrid.cpp @@ -31,8 +31,8 @@ LPEConstructGrid::LPEConstructGrid(LivePathEffectObject *lpeobject) : nr_x.param_make_integer(); nr_y.param_make_integer(); - nr_x.param_set_range(1, NR_HUGE); - nr_y.param_set_range(1, NR_HUGE); + nr_x.param_set_range(1, 1e10); + nr_y.param_set_range(1, 1e10); } LPEConstructGrid::~LPEConstructGrid() diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp index 89fdef2f0..e1e21107c 100644 --- a/src/live_effects/lpe-curvestitch.cpp +++ b/src/live_effects/lpe-curvestitch.cpp @@ -192,6 +192,7 @@ LPECurveStitch::resetDefaults(SPItem * item) /** /todo check whether this special case is necessary. It seems to "bug" editing behavior: * scaling an object with transforms preserved behaves differently from scaling with * transforms optimized (difference caused by this special method). + * special casing is probably needed, because rotation should not be propagated to the strokepath. */ void LPECurveStitch::transform_multiply(Geom::Matrix const& postmul, bool set) diff --git a/src/live_effects/lpe-extrude.cpp b/src/live_effects/lpe-extrude.cpp index c861515aa..5f63d0567 100644 --- a/src/live_effects/lpe-extrude.cpp +++ b/src/live_effects/lpe-extrude.cpp @@ -18,6 +18,8 @@ #include <2geom/transforms.h> #include <algorithm> +#include "sp-item.h" + namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp index 00f7ec193..b1337d5fb 100644 --- a/src/live_effects/lpe-gears.cpp +++ b/src/live_effects/lpe-gears.cpp @@ -220,7 +220,7 @@ LPEGears::LPEGears(LivePathEffectObject *lpeobject) : */ teeth.param_make_integer(); - teeth.param_set_range(3, NR_HUGE); + teeth.param_set_range(3, 1e10); registerParameter( dynamic_cast<Parameter *>(&teeth) ); registerParameter( dynamic_cast<Parameter *>(&phi) ); } diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index b3aa2df45..b8e9b8cf9 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -56,17 +56,19 @@ public: static std::vector<Geom::Interval> complementOf(Geom::Interval I, std::vector<Geom::Interval> domain){ std::vector<Geom::Interval> ret; - double min = domain.front().min(); - double max = domain.back().max(); - Geom::Interval I1 = Geom::Interval(min,I.min()); - Geom::Interval I2 = Geom::Interval(I.max(),max); - - for (unsigned i = 0; i<domain.size(); i++){ - boost::optional<Geom::Interval> I1i = intersect(domain.at(i),I1); - if (I1i && !I1i->isSingular()) ret.push_back(I1i.get()); - boost::optional<Geom::Interval> I2i = intersect(domain.at(i),I2); - if (I2i && !I2i->isSingular()) ret.push_back(I2i.get()); - } + if (!domain.empty()) { + double min = domain.front().min(); + double max = domain.back().max(); + Geom::Interval I1 = Geom::Interval(min,I.min()); + Geom::Interval I2 = Geom::Interval(I.max(),max); + + for (unsigned i = 0; i<domain.size(); i++){ + boost::optional<Geom::Interval> I1i = intersect(domain.at(i),I1); + if (I1i && !I1i->isSingular()) ret.push_back(I1i.get()); + boost::optional<Geom::Interval> I2i = intersect(domain.at(i),I2); + if (I2i && !I2i->isSingular()) ret.push_back(I2i.get()); + } + } return ret; } diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index ec0dee0be..aa916318d 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -245,6 +245,7 @@ livepatheffect_on_repr_attr_changed ( Inkscape::XML::Node * /*repr*/, /** * If this has other users, create a new private duplicate and return it * returns 'this' when no forking was necessary (and therefore no duplicate was made) + * Check out sp_lpe_item_fork_path_effects_if_necessary ! */ LivePathEffectObject * LivePathEffectObject::fork_private_if_necessary(unsigned int nr_of_allowed_users) @@ -252,11 +253,12 @@ LivePathEffectObject::fork_private_if_necessary(unsigned int nr_of_allowed_users if (SP_OBJECT_HREFCOUNT(this) > nr_of_allowed_users) { SPDocument *doc = SP_OBJECT_DOCUMENT(this); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); + Inkscape::XML::Node *dup_repr = SP_OBJECT_REPR (this)->duplicate(xml_doc); - Inkscape::XML::Node *repr = SP_OBJECT_REPR (this)->duplicate(xml_doc); - SP_OBJECT_REPR (SP_DOCUMENT_DEFS (doc))->addChild(repr, NULL); - LivePathEffectObject *lpeobj_new = (LivePathEffectObject *) doc->getObjectByRepr(repr); - Inkscape::GC::release(repr); + SP_OBJECT_REPR (SP_DOCUMENT_DEFS (doc))->addChild(dup_repr, NULL); + LivePathEffectObject *lpeobj_new = LIVEPATHEFFECT( doc->getObjectByRepr(dup_repr) ); + + Inkscape::GC::release(dup_repr); return lpeobj_new; } return this; |
