summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2014-06-24 17:26:21 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2014-06-24 17:26:21 +0000
commite6530013ca6fa356b62bdcd0d2ff158617fe0a9f (patch)
tree2456a39e2ddaeaaaeb21da772e1e3cb1fcf447d3
parentFix for ungrouping/non-LPEItem masks (diff)
downloadinkscape-e6530013ca6fa356b62bdcd0d2ff158617fe0a9f.tar.gz
inkscape-e6530013ca6fa356b62bdcd0d2ff158617fe0a9f.zip
fix bug introduced in rev. 13403 (merge with trunk)
(bzr r13341.1.67)
-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 87c9ad6fd..9e2eff6bb 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;
@@ -421,7 +423,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;
@@ -458,7 +460,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);
@@ -970,6 +972,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 2bde25be8..3e858748d 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;