summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2014-06-24 16:59:15 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2014-06-24 16:59:15 +0000
commit24b274159b8a31784883b5e440457ab90d6107d6 (patch)
treebaf81afa0ca699ccf285750e9dadc6d19cdcdebe /src
parentUpdate (diff)
downloadinkscape-24b274159b8a31784883b5e440457ab90d6107d6.tar.gz
inkscape-24b274159b8a31784883b5e440457ab90d6107d6.zip
revert rev. 13429 that broke LPE Bend, Envelope, etc etc.
very sorry about that. (bzr r13439)
Diffstat (limited to 'src')
-rw-r--r--src/sp-lpe-item.cpp28
-rw-r--r--src/sp-lpe-item.h11
2 files changed, 28 insertions, 11 deletions
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index e04d8f841..a5d70d573 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -50,6 +50,8 @@
#include <algorithm>
/* LPEItem base class */
+static void sp_lpe_item_enable_path_effects(SPLPEItem *lpeitem, bool enable);
+
static void lpeobject_ref_modified(SPObject *href, guint flags, SPLPEItem *lpeitem);
static void sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem);
@@ -113,7 +115,7 @@ void SPLPEItem::set(unsigned int key, gchar const* value) {
this->current_path_effect = NULL;
// Disable the path effects while populating the LPE list
- enablePathEffects(false);
+ sp_lpe_item_enable_path_effects(this, false);
// disconnect all modified listeners:
for ( std::list<sigc::connection>::iterator mod_it = this->lpe_modified_connection_list->begin();
@@ -166,7 +168,7 @@ void SPLPEItem::set(unsigned int key, gchar const* value) {
}
}
- enablePathEffects(true);
+ sp_lpe_item_enable_path_effects(this, true);
}
break;
@@ -422,7 +424,7 @@ void SPLPEItem::addPathEffect(gchar *value, bool reset)
sp_lpe_item_update_patheffect(this, false, true);
// Disable the path effects while preparing the new lpe
- enablePathEffects(false);
+ sp_lpe_item_enable_path_effects(this, false);
// Add the new reference to the list of LPE references
HRefList hreflist;
@@ -459,7 +461,7 @@ void SPLPEItem::addPathEffect(gchar *value, bool reset)
}
//Enable the path effects now that everything is ready to apply the new path effect
- enablePathEffects(true);
+ sp_lpe_item_enable_path_effects(this, true);
// Apply the path effect
sp_lpe_item_update_patheffect(this, true, true);
@@ -955,6 +957,24 @@ bool SPLPEItem::forkPathEffectsIfNecessary(unsigned int nr_of_allowed_users)
return forked;
}
+// Enable or disable the path effects of the item.
+// The counter allows nested calls
+static void sp_lpe_item_enable_path_effects(SPLPEItem *lpeitem, bool enable)
+{
+ if (enable) {
+ lpeitem->path_effects_enabled++;
+ }
+ else {
+ lpeitem->path_effects_enabled--;
+ }
+}
+
+// Are the path effects enabled on this item ?
+bool SPLPEItem::pathEffectsEnabled() const
+{
+ return path_effects_enabled > 0;
+}
+
/*
Local Variables:
mode:c++
diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h
index da77ba2ca..5a38fdd0b 100644
--- a/src/sp-lpe-item.h
+++ b/src/sp-lpe-item.h
@@ -39,13 +39,11 @@ namespace LivePathEffect{
typedef std::list<Inkscape::LivePathEffect::LPEObjectReference *> PathEffectList;
class SPLPEItem : public SPItem {
-private:
- mutable bool path_effects_enabled; // (mutable because preserves logical const-ness)
-
public:
- SPLPEItem();
- virtual ~SPLPEItem();
+ SPLPEItem();
+ virtual ~SPLPEItem();
+ int path_effects_enabled;
PathEffectList* path_effect_list;
std::list<sigc::connection> *lpe_modified_connection_list; // this list contains the connections for listening to lpeobject parameter changes
@@ -74,8 +72,7 @@ public:
bool performPathEffect(SPCurve *curve);
- void enablePathEffects(bool enable) const { path_effects_enabled = enable; }; // (const because logically const)
- bool pathEffectsEnabled() const { return path_effects_enabled; };
+ bool pathEffectsEnabled() const;
bool hasPathEffect() const;
bool hasPathEffectOfType(int const type) const;
bool hasPathEffectRecursive() const;