From 71146abe8aba032d73788a625fee5769a581bd3c Mon Sep 17 00:00:00 2001 From: cilix42 Date: Mon, 19 May 2008 17:02:06 +0000 Subject: [PATCH] Add checkbox for LPEs to temporarily disable them on canvas (but keep them applied to the object) --- src/live_effects/effect.cpp | 2 ++ src/live_effects/effect.h | 7 +++++-- src/object-edit.cpp | 1 + src/shape-editor.cpp | 3 ++- src/sp-lpe-item.cpp | 6 ++++-- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 2e33098d2..906955575 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -144,9 +144,11 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj) Effect::Effect(LivePathEffectObject *lpeobject) : oncanvasedit_it(0), + is_visible(_("Is visible?"), _("If unchecked, the effect remains applied to the object but is temporarily disabled on canvas"), "is_visible", &wr, this, true), lpeobj(lpeobject), concatenate_before_pwd2(false) { + registerParameter( dynamic_cast(&is_visible) ); } Effect::~Effect() diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index ad2d5126f..1255595d0 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -18,6 +18,7 @@ #include "util/enums.h" #include "sp-lpe-item.h" #include "knotholder.h" +#include "parameter/bool.h" #define LPE_CONVERSION_TOLERANCE 0.01 // FIXME: find good solution for this. @@ -75,8 +76,6 @@ enum EffectType { extern const Util::EnumData LPETypeData[INVALID_LPE]; extern const Util::EnumDataConverter LPETypeConverter; -class Parameter; - class Effect { public: static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj); @@ -111,6 +110,8 @@ public: void readallParameters(Inkscape::XML::Node * repr); void setParameter(const gchar * key, const gchar * new_value); + inline bool isVisible() { return is_visible; } + void editNextParamOncanvas(SPItem * item, SPDesktop * desktop); protected: @@ -135,6 +136,8 @@ protected: std::vector param_vector; std::vector > knotholder_func_vector; int oncanvasedit_it; + BoolParam is_visible; + Inkscape::UI::Widget::Registry wr; LivePathEffectObject *lpeobj; diff --git a/src/object-edit.cpp b/src/object-edit.cpp index 46ab877b6..091c99734 100644 --- a/src/object-edit.cpp +++ b/src/object-edit.cpp @@ -73,6 +73,7 @@ SPKnotHolder * sp_item_knot_holder(SPItem *item, SPDesktop *desktop) { if (sp_lpe_item_has_path_effect(SP_LPE_ITEM(item)) && + sp_lpe_item_get_livepatheffect(SP_LPE_ITEM(item))->isVisible() && sp_lpe_item_get_livepatheffect(SP_LPE_ITEM(item))->providesKnotholder()) { return sp_lpe_knot_holder(item, desktop); } else diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index f0bec7ba9..40e92e0dd 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -192,9 +192,10 @@ void ShapeEditor::set_item(SPItem *item) { if (item) { SPLPEItem *lpeitem = SP_LPE_ITEM(item); if (!sp_lpe_item_has_path_effect(lpeitem) || + !sp_lpe_item_get_livepatheffect(lpeitem)->isVisible() || !sp_lpe_item_get_livepatheffect(lpeitem)->providesKnotholder()) { // only create nodepath if the item either doesn't have an LPE - // or the LPE doesn't provide a knotholder itself + // or the LPE is invisible or it doesn't provide a knotholder itself this->nodepath = sp_nodepath_new(desktop, item, (prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0)); } diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 87e737435..f16b455dd 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -257,8 +257,10 @@ void sp_lpe_item_perform_path_effect(SPLPEItem *lpeitem, SPCurve *curve) { if (sp_lpe_item_has_path_effect(lpeitem)) { LivePathEffectObject *lpeobj = sp_lpe_item_get_livepatheffectobject(lpeitem); - lpeobj->lpe->doBeforeEffect(lpeitem); - lpeobj->lpe->doEffect(curve); + if (lpeobj->lpe->isVisible()) { + lpeobj->lpe->doBeforeEffect(lpeitem); + lpeobj->lpe->doEffect(curve); + } } SPObject *parent = lpeitem->parent; -- 2.30.2