summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5cc69f6)
raw | patch | inline | side by side (parent: 5cc69f6)
author | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 10 Jun 2008 12:35:36 +0000 (12:35 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 10 Jun 2008 12:35:36 +0000 (12:35 +0000) |
index f0862c87483ccf44958ddc8b068f71ff4165013f..ea90c4254926df649f3648f89890e26f73c77218 100644 (file)
--- a/src/knot-holder-entity.h
+++ b/src/knot-holder-entity.h
virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state) = 0;
virtual NR::Point knot_get() = 0;
virtual void knot_click(guint /*state*/) {}
- virtual void onKnotUngrabbed() {} // this is called 'manually' from KnotHolder; would it be
- // more efficient to establish another signal connection?
+ virtual void onKnotUngrabbed() {}
void update_knot();
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index 1ca280d48c0b85db91f0cc52b1909264d3082dc3..f78198275ee83bf6bdf5075d2818306b4a427f88 100644 (file)
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
#include "box3d.h"
#include "sp-pattern.h"
#include "style.h"
+#include "live_effects/lpeobject.h"
#include "xml/repr.h" // for debugging only
/* do cleanup tasks (e.g., for LPE items write the parameter values
* that were changed by dragging the handle to SVG)
*/
+ if (SP_IS_LPE_ITEM(item)) {
+ // This writes all parameters to SVG. Is this sufficiently efficient or should we only write
+ // the ones that were changed (e.g., via the individual handles' onKnotUngrabbed() method?
+ Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item));
+ if (lpe) {
+ LivePathEffectObject *lpeobj = lpe->getLPEObj();
+ SP_OBJECT(lpeobj)->updateRepr();
+ }
+ }
+ // this was once used to write individual parameter values to SVG but this is now done globally above;
+ // we leave the calls to onKnotUngrabbed, anyway, in case any other cleanup tasks need to be done
for(std::list<KnotHolderEntity *>::iterator i = this->entity.begin(); i != this->entity.end(); ++i) {
KnotHolderEntity *e = *i;
if (e->knot == knot) {
index b08077e795050b11275748281085bdbdcff4f638..de41d6a59b6525e045051562169739c2ae6722d5 100644 (file)
}
+void
+Effect::writeParamsToSVG() {
+ g_print ("Parameters get written to SVG\n");
+ std::vector<Inkscape::LivePathEffect::Parameter *>::iterator p;
+ for (p = param_vector.begin(); p != param_vector.end(); ++p) {
+ g_print ("writing parameter %s to SVG\n", (*p)->param_key.c_str());
+ (*p)->write_to_SVG();
+ }
+}
+
/*
* Here be the doEffect function chain:
*/
index f0d0ffdd5669c802ab96fb96fc3e6ba7c8ee34aa..b78e931f92f2e4e2d04b58a1a330d3c67ed39224 100644 (file)
virtual void doOnApply (SPLPEItem *lpeitem);
virtual void doBeforeEffect (SPLPEItem *lpeitem);
+ void writeParamsToSVG();
virtual void doEffect (SPCurve * curve);
index 9c7ed0a7e67ba00355a0aa92c93f5e4cbe18410a..a7963ce7b136946906145726595e105dcadc255e 100644 (file)
virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state);
virtual NR::Point knot_get();
- virtual void onKnotUngrabbed();
};
class KnotHolderEntityRightEnd : public KnotHolderEntity
virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state);
virtual NR::Point knot_get();
- virtual void onKnotUngrabbed();
};
// TODO: Make this more generic
@@ -100,20 +98,6 @@ KnotHolderEntityRightEnd::knot_set(NR::Point const &p, NR::Point const &/*origin
bisector_end_set(item, p, false);
}
-void
-KnotHolderEntityLeftEnd::onKnotUngrabbed()
-{
- LPEPerpBisector *lpe = get_effect(item);
- lpe->length_left.write_to_SVG();
-}
-
-void
-KnotHolderEntityRightEnd::onKnotUngrabbed()
-{
- LPEPerpBisector *lpe = get_effect(item);
- lpe->length_right.write_to_SVG();
-}
-
/**
NR::Point path_start_get(SPItem *item) {
Inkscape::LivePathEffect::LPEPerpBisector *lpe =
index 6fc7161edd246ded109bdd0c06c76c28dc42dba4..2115e9d7ef1cd14fc27762e7952cb98897fc9bf1 100644 (file)
virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state);
virtual NR::Point knot_get();
- virtual void onKnotUngrabbed();
};
class KnotHolderEntityLeftEnd : public KnotHolderEntity
virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state);
virtual NR::Point knot_get();
- virtual void onKnotUngrabbed();
};
class KnotHolderEntityRightEnd : public KnotHolderEntity
virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state);
virtual NR::Point knot_get();
- virtual void onKnotUngrabbed();
};
} // namespace TtC
return lpe->D;
}
-void
-KnotHolderEntityAttachPt::onKnotUngrabbed()
-{
- LPETangentToCurve *lpe = get_effect(item);
- lpe->t_attach.write_to_SVG();
-}
-
-void
-KnotHolderEntityLeftEnd::onKnotUngrabbed()
-{
- LPETangentToCurve *lpe = get_effect(item);
- lpe->length_left.write_to_SVG();
-}
-
-void
-KnotHolderEntityRightEnd::onKnotUngrabbed()
-{
- LPETangentToCurve *lpe = get_effect(item);
- lpe->length_right.write_to_SVG();
-}
-
} // namespace TtC
} //namespace LivePathEffect
index 0a7fb5eb078eb946602c310bf48b9dc048ae3fd5..432a484ee831bdd63c1a5b1705991feee405ac37 100644 (file)
// lpeobj->lpe->write(repr); something like this.
+ lpeobj->lpe->writeParamsToSVG();
+
if (((SPObjectClass *) livepatheffect_parent_class)->write)
(* ((SPObjectClass *) livepatheffect_parent_class)->write)(object, repr, flags);