From b472007094a3724bef949ac45a6294d0e9cb8a01 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 16 Jun 2014 23:39:13 +0200 Subject: LPEItem enabling/disabling: rewrite mechanism to be more robust. the previous nesting behavior was not used, and code relied on non-nesting behavior. (bzr r13429) --- src/sp-lpe-item.cpp | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'src/sp-lpe-item.cpp') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index bfecdcf98..ad0902967 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -50,8 +50,6 @@ #include /* 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); @@ -115,7 +113,7 @@ void SPLPEItem::set(unsigned int key, gchar const* value) { this->current_path_effect = NULL; // Disable the path effects while populating the LPE list - sp_lpe_item_enable_path_effects(this, false); + enablePathEffects(false); // disconnect all modified listeners: for ( std::list::iterator mod_it = this->lpe_modified_connection_list->begin(); @@ -168,7 +166,7 @@ void SPLPEItem::set(unsigned int key, gchar const* value) { } } - sp_lpe_item_enable_path_effects(this, true); + enablePathEffects(true); } break; @@ -409,7 +407,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 - sp_lpe_item_enable_path_effects(this, false); + enablePathEffects(false); // Add the new reference to the list of LPE references HRefList hreflist; @@ -446,7 +444,7 @@ void SPLPEItem::addPathEffect(gchar *value, bool reset) } //Enable the path effects now that everything is ready to apply the new path effect - sp_lpe_item_enable_path_effects(this, true); + enablePathEffects(true); // Apply the path effect sp_lpe_item_update_patheffect(this, true, true); @@ -942,24 +940,6 @@ 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++ -- cgit v1.2.3 From 9494f126c9a54446dd5d049bfc5704c702dc9047 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 22 Jun 2014 18:21:48 -0400 Subject: Fix for ungrouping/non-LPEItem masks Fixed bugs: - https://launchpad.net/bugs/1333020 (bzr r13436) --- src/sp-lpe-item.cpp | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'src/sp-lpe-item.cpp') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index ad0902967..e04d8f841 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -337,16 +337,24 @@ lpeobject_ref_modified(SPObject */*href*/, guint /*flags*/, SPLPEItem *lpeitem) static void sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem) { + g_return_if_fail(lpeitem != NULL); SPMask * mask = lpeitem->mask_ref->getObject(); - if(mask) + + if (mask) { - sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(mask->firstChild())); + if (SPLPEItem* maskChild = dynamic_cast(mask->firstChild())) { + sp_lpe_item_create_original_path_recursive(maskChild); + } } + SPClipPath * clipPath = lpeitem->clip_ref->getObject(); - if(clipPath) + if (clipPath) { - sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild())); + if (SPLPEItem* clipChild = dynamic_cast(clipPath->firstChild())) { + sp_lpe_item_create_original_path_recursive(clipChild); + } } + if (SP_IS_GROUP(lpeitem)) { GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( GSList const *iter = item_list; iter; iter = iter->next ) { @@ -367,15 +375,22 @@ sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem) static void sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem) { + g_return_if_fail(lpeitem != NULL); SPMask * mask = lpeitem->mask_ref->getObject(); - if(mask) + + if (mask) { - sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild())); + if (SPLPEItem* maskChild = dynamic_cast(mask->firstChild())) { + sp_lpe_item_cleanup_original_path_recursive(maskChild); + } } + SPClipPath * clipPath = lpeitem->clip_ref->getObject(); - if(clipPath) + if (clipPath) { - sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild())); + if (SPLPEItem* clipChild = dynamic_cast(clipPath->firstChild())) { + sp_lpe_item_cleanup_original_path_recursive(clipChild); + } } if (SP_IS_GROUP(lpeitem)) { -- cgit v1.2.3 From 24b274159b8a31784883b5e440457ab90d6107d6 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Tue, 24 Jun 2014 18:59:15 +0200 Subject: revert rev. 13429 that broke LPE Bend, Envelope, etc etc. very sorry about that. (bzr r13439) --- src/sp-lpe-item.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/sp-lpe-item.cpp') 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 /* 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::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++ -- cgit v1.2.3 From 6829ce76e2ab77859c1a5fdacbb2fa71109d65b0 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 27 Jun 2014 18:28:46 +0200 Subject: Remove the incorrect fix for the bug 1241902 (bzr r13441) --- src/sp-lpe-item.cpp | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) (limited to 'src/sp-lpe-item.cpp') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index a5d70d573..321d2fc42 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -340,22 +340,6 @@ static void sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem) { g_return_if_fail(lpeitem != NULL); - SPMask * mask = lpeitem->mask_ref->getObject(); - - if (mask) - { - if (SPLPEItem* maskChild = dynamic_cast(mask->firstChild())) { - sp_lpe_item_create_original_path_recursive(maskChild); - } - } - - SPClipPath * clipPath = lpeitem->clip_ref->getObject(); - if (clipPath) - { - if (SPLPEItem* clipChild = dynamic_cast(clipPath->firstChild())) { - sp_lpe_item_create_original_path_recursive(clipChild); - } - } if (SP_IS_GROUP(lpeitem)) { GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); @@ -378,22 +362,6 @@ static void sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem) { g_return_if_fail(lpeitem != NULL); - SPMask * mask = lpeitem->mask_ref->getObject(); - - if (mask) - { - if (SPLPEItem* maskChild = dynamic_cast(mask->firstChild())) { - sp_lpe_item_cleanup_original_path_recursive(maskChild); - } - } - - SPClipPath * clipPath = lpeitem->clip_ref->getObject(); - if (clipPath) - { - if (SPLPEItem* clipChild = dynamic_cast(clipPath->firstChild())) { - sp_lpe_item_cleanup_original_path_recursive(clipChild); - } - } if (SP_IS_GROUP(lpeitem)) { GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); @@ -640,6 +608,9 @@ bool SPLPEItem::hasPathEffectRecursive() const } } +//The next 3 functions are because the revert of the bug 1241902 +//for the moment not used + void sp_lpe_item_apply_to_clippath(SPItem * item) { -- cgit v1.2.3