diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-03-18 20:41:04 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-03-18 20:41:04 +0000 |
| commit | bccbad7c2400905a823f9241294fa62e90c9a6a3 (patch) | |
| tree | 8ac9e06894b794091dc537c44fe8f3711e93df66 /src | |
| parent | update to trunk (diff) | |
| download | inkscape-bccbad7c2400905a823f9241294fa62e90c9a6a3.tar.gz inkscape-bccbad7c2400905a823f9241294fa62e90c9a6a3.zip | |
fix to trunk
(bzr r13682.1.24)
Diffstat (limited to 'src')
| -rw-r--r-- | src/knotholder.cpp | 11 | ||||
| -rw-r--r-- | src/live_effects/effect.cpp | 9 | ||||
| -rw-r--r-- | src/live_effects/effect.h | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-mirror_symmetry.cpp | 47 | ||||
| -rw-r--r-- | src/live_effects/lpe-mirror_symmetry.h | 2 |
5 files changed, 19 insertions, 51 deletions
diff --git a/src/knotholder.cpp b/src/knotholder.cpp index de1b88b2c..6d39fa5fa 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -68,14 +68,9 @@ KnotHolder::KnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFun sizeUpdatedConn = ControlManager::getManager().connectCtrlSizeChanged(sigc::mem_fun(*this, &KnotHolder::updateControlSizes)); } -KnotHolder::~KnotHolder() { - if(SP_IS_LPE_ITEM(item)){ - Inkscape::LivePathEffect::Effect *effect = SP_LPE_ITEM(item)->getCurrentLPE(); - if(effect){ - effect->removeHandles(); - } - } - sp_object_unref(item); +KnotHolder::~KnotHolder() +{ + sp_object_unref(item); for (std::list<KnotHolderEntity *>::iterator i = entity.begin(); i != entity.end(); ++i) { diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 5cff0f352..042bac523 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -373,7 +373,6 @@ Effect::Effect(LivePathEffectObject *lpeobject) registerParameter( dynamic_cast<Parameter *>(&is_visible) ); is_visible.widget_is_visible = false; current_zoom = 0.0; - knot_holder = NULL; } Effect::~Effect() @@ -620,7 +619,7 @@ Effect::registerParameter(Parameter * param) void Effect::addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { using namespace Inkscape::LivePathEffect; - knot_holder = knotholder; + // add handles provided by the effect itself addKnotHolderEntities(knotholder, desktop, item); @@ -630,12 +629,6 @@ Effect::addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { } } -void -Effect::removeHandles(){ - if(knot_holder){ - knot_holder = NULL; - } -} /** * Return a vector of PathVectors which contain all canvas indicators for this effect. * This is the function called by external code to get all canvas indicators (effect and its parameters) diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index bfce7b7dd..ac1f0b8dc 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -101,7 +101,6 @@ public: // (but spiro lpe still needs it!) virtual LPEPathFlashType pathFlashType() const { return DEFAULT; } void addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item); - void removeHandles(); std::vector<Geom::PathVector> getCanvasIndicators(SPLPEItem const* lpeitem); inline bool providesOwnFlashPaths() const { diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index f39b92e58..e549ad697 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -27,7 +27,6 @@ #include "knot-holder-entity.h" #include "knotholder.h" - namespace Inkscape { namespace LivePathEffect { @@ -43,9 +42,12 @@ namespace MS { class KnotHolderEntityCenterMirrorSymmetry : public LPEKnotHolderEntity { public: - KnotHolderEntityCenterMirrorSymmetry(LPEMirrorSymmetry *effect) : LPEKnotHolderEntity(effect) {}; + KnotHolderEntityCenterMirrorSymmetry(LPEMirrorSymmetry *effect) : LPEKnotHolderEntity(effect) {this->knoth = effect->knoth;}; + virtual ~KnotHolderEntityCenterMirrorSymmetry() { this->knoth = NULL;} virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); virtual Geom::Point knot_get() const; +private: + KnotHolder *knoth; }; } // namespace MS @@ -56,19 +58,19 @@ LPEMirrorSymmetry::LPEMirrorSymmetry(LivePathEffectObject *lpeobject) : discard_orig_path(_("Discard original path?"), _("Check this to only keep the mirrored part of the path"), "discard_orig_path", &wr, this, false), fusionPaths(_("Fusioned symetry"), _("Fusion right side whith symm"), "fusionPaths", &wr, this, true), reverseFusion(_("Reverse fusion"), _("Reverse fusion"), "reverseFusion", &wr, this, false), - fixedReflectionLine(_("Fixed reflection line"), _("Fixed reflection line"), "fixedReflectionLine", &wr, this, false), reflection_line(_("Reflection line:"), _("Line which serves as 'mirror' for the reflection"), "reflection_line", &wr, this, "M0,0 L1,0"), - center(_("Center of mirroring (X or Y)"), _("Center of the mirror"), "center", &wr, this, "Adjust the center of mirroring") + center(_("Center of mirroring (X or Y)"), _("Center of the mirror"), "center", &wr, this, "Adjust the center of mirroring"), + knoth(NULL) { show_orig_path = true; + registerParameter(&mode); registerParameter( &discard_orig_path); registerParameter( &fusionPaths); registerParameter( &reverseFusion); - registerParameter( &distanceToX); - registerParameter( &distanceToY); registerParameter( &reflection_line); registerParameter( ¢er); + } LPEMirrorSymmetry::~LPEMirrorSymmetry() @@ -81,7 +83,6 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem) using namespace Geom; SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem); - SPObject *subitem = static_cast<SPObject *>(item); Point A(boundingbox_X.max(), boundingbox_Y.min()); Point B(boundingbox_X.max(), boundingbox_Y.max()); Point C(boundingbox_X.max(), boundingbox_Y.middle()); @@ -93,15 +94,15 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem) A = Geom::Point(center[X],boundingbox_Y.min()); B = Geom::Point(center[X],boundingbox_Y.max()); } - if( mode == MT_X || mode == MT_Y || mode == MT_FIXED_X || mode == MT_FIXED_Y ){ + if( mode == MT_X || mode == MT_Y ){ Geom::Path path; path.start( A ); path.appendNew<Geom::LineSegment>( B ); reflection_line.set_new_value(path.toPwSb(), true); lineSeparation.setPoints(A,B); center.param_setValue(path.pointAt(0.5)); - if(knot_holder){ - knot_holder->update_knots(); + if(knoth){ + knoth->update_knots(); } } else if( mode == MT_FREE) { std::vector<Geom::Path> mline(reflection_line.get_pathvector()); @@ -117,8 +118,8 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem) A = mline[0].initialPoint(); B = mline[0].finalPoint(); lineSeparation.setPoints(A,B); - if(knot_holder){ - knot_holder->update_knots(); + if(knoth){ + knoth->update_knots(); } } previousCenter = center; @@ -133,27 +134,6 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem const* lpeitem) { using namespace Geom; - /* - SPDocument *doc = lpeitem->document; - Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::XML::Node *group = xml_doc->createElement("svg:g"); - group->setAttribute("inkscape:groupmode", "layer"); - SPLPEItem* item = const_cast<SPLPEItem*>(lpeitem); - Inkscape::XML::Node *current = item->getRepr(); - gint topmost = current->position(); - Inkscape::XML::Node *top_current = current->parent(); - Inkscape::XML::Node *spnew = current->duplicate(xml_doc); - sp_repr_unparent(current); - group->appendChild(spnew); - Inkscape::GC::release(spnew); - top_current->appendChild(group); - group->setPosition(topmost + 1); - gchar *href = g_strdup_printf("#%s", item->getCurrentLPE()->getRepr()->attribute("id")); - SP_LPE_ITEM(group)->addPathEffect(href, true); - item->removeCurrentPathEffect(false); - g_free(href); - Inkscape::GC::release(group); - */ original_bbox(lpeitem); Point A(boundingbox_X.max(), boundingbox_Y.min()); @@ -315,6 +295,7 @@ LPEMirrorSymmetry::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector void LPEMirrorSymmetry::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { { + knoth = knotholder; KnotHolderEntity *e = new MS::KnotHolderEntityCenterMirrorSymmetry(this); e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Adjust the center") ); diff --git a/src/live_effects/lpe-mirror_symmetry.h b/src/live_effects/lpe-mirror_symmetry.h index c18fb265d..97d641bcc 100644 --- a/src/live_effects/lpe-mirror_symmetry.h +++ b/src/live_effects/lpe-mirror_symmetry.h @@ -62,11 +62,11 @@ private: BoolParam discard_orig_path; BoolParam fusionPaths; BoolParam reverseFusion; - BoolParam fixedReflectionLine; PathParam reflection_line; Geom::Line lineSeparation; Geom::Point previousCenter; PointParam center; + KnotHolder *knoth; LPEMirrorSymmetry(const LPEMirrorSymmetry&); LPEMirrorSymmetry& operator=(const LPEMirrorSymmetry&); |
