Code

2 LPE things:
authorjohanengelen <johanengelen@users.sourceforge.net>
Sun, 26 Aug 2007 12:44:19 +0000 (12:44 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Sun, 26 Aug 2007 12:44:19 +0000 (12:44 +0000)
* Add changed signal to LPE PathParameter
* removed origin parameter from path along path as it is not necessary any more

src/live_effects/lpe-skeletalstrokes.cpp
src/live_effects/lpe-skeletalstrokes.h
src/live_effects/parameter/path.cpp
src/live_effects/parameter/path.h

index 4e8a589ce6355fe2f59e20e31904a1fdc5d3f9c1..162dfe8a460f2b61b42aa7b9424b2151f0f938b7 100644 (file)
@@ -59,14 +59,10 @@ static const Util::EnumDataConverter<SkelCopyType> SkelCopyTypeConverter(SkelCop
 LPESkeletalStrokes::LPESkeletalStrokes(LivePathEffectObject *lpeobject) :\r
     Effect(lpeobject),\r
     pattern(_("Pattern"), _("Path to put along path"), "pattern", &wr, this, "M0,0 L1,1"),\r
-    origin(_("Origin"), _("Startpoint of the pattern path to put along path"), "origin", &wr, this, Geom::Point(0,0)),\r
     copytype(_("Copytype"), _("How to shape the pattern path along the path"), "copytype", SkelCopyTypeConverter, &wr, this, SSCT_SINGLE_STRETCHED)\r
 {\r
-    registerParameter( dynamic_cast<Parameter *>(&origin) );\r
     registerParameter( dynamic_cast<Parameter *>(&pattern) );\r
     registerParameter( dynamic_cast<Parameter *>(&copytype) );\r
-\r
-    pattern.signal_path_pasted.connect(sigc::mem_fun(*this, &LPESkeletalStrokes::on_pattern_pasted));\r
 }\r
 \r
 LPESkeletalStrokes::~LPESkeletalStrokes()\r
@@ -91,9 +87,13 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in
     n = force_continuity(remove_short_cuts(n,.1));\r
 \r
     D2<Piecewise<SBasis> > patternd2 = make_cuts_independant(pattern);\r
-    Piecewise<SBasis> x=Piecewise<SBasis>(patternd2[0]-origin[0]);\r
-    Piecewise<SBasis> y=Piecewise<SBasis>(patternd2[1]-origin[1]);\r
+    Piecewise<SBasis> x=Piecewise<SBasis>(patternd2[0]);\r
+    Piecewise<SBasis> y=Piecewise<SBasis>(patternd2[1]);\r
     Interval pattBnds = bounds_exact(x);\r
+    x -= pattBnds.min();\r
+    Interval pattBndsY = bounds_exact(y);\r
+    y -= (pattBndsY.max()+pattBndsY.min())/2;\r
+\r
 \r
     int nbCopies = int(uskeleton.cuts.back()/pattBnds.extent());\r
     double scaling = 1;\r
@@ -121,7 +121,6 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in
 \r
     double pattWidth = pattBnds.extent() * scaling;\r
 \r
-    x-=pattBnds.min();\r
     if (scaling != 1)\r
         x*=scaling;\r
 \r
@@ -134,14 +133,6 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in
     return output;\r
 }\r
 \r
-void\r
-LPESkeletalStrokes::on_pattern_pasted()\r
-{\r
-    // a new pattern was pasted through the dialog.  overwrite the origin thingie to the first point of the path\r
-    origin.param_setValue(pattern.valueAt(0));\r
-}\r
-\r
-\r
 \r
 } // namespace LivePathEffect\r
 } /* namespace Inkscape */\r
index 159a82f571df53e183ef5d824e257ecda2c11716..b92ea8ecf4063e45ab9c81c0893d8ee770f5b652 100644 (file)
@@ -11,7 +11,6 @@
 \r
 #include "live_effects/effect.h"\r
 #include "live_effects/parameter/path.h"\r
-#include "live_effects/parameter/point.h"\r
 #include "live_effects/parameter/enum.h"\r
 \r
 namespace Inkscape {\r
@@ -34,7 +33,6 @@ public:
 \r
 private:\r
     PathParam  pattern;\r
-    PointParam origin;\r
     EnumParam<SkelCopyType> copytype;\r
 \r
     void on_pattern_pasted();\r
index f24fa933a053da5736ec95fca3742b7bb8abdf4e..343a2f840aa5776f6ee7628400ba4fca60d19d93 100644 (file)
@@ -67,6 +67,7 @@ PathParam::param_readSVGValue(const gchar * strvalue)
             newpath.concat( temppath[i].toPwSb() );\r
         }\r
         *( dynamic_cast<Geom::Piecewise<Geom::D2<Geom::SBasis> > *> (this) ) = newpath;\r
+        signal_path_changed.emit();\r
         return true;\r
     }\r
 \r
index 0b0d5f633e19a0528746bc5706086eb74ff60328..e26611b859da8ab8d0a2b7390b2aebd3dd895258 100644 (file)
@@ -41,6 +41,7 @@ public:
     void param_set_default();\r
 \r
     sigc::signal <void> signal_path_pasted;\r
+    sigc::signal <void> signal_path_changed;\r
 \r
 private:\r
     PathParam(const PathParam&);\r