summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-05-19 17:02:06 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-05-19 17:02:06 +0000
commit9b424870613f4b345cf64bdfcb03889077a0597a (patch)
tree9b5251a8c8cff0c47b82bd7f2c0aafd22a2b85b0 /src
parentApplying several of Inductiveload's enhancements and fixes to his extensions.... (diff)
downloadinkscape-9b424870613f4b345cf64bdfcb03889077a0597a.tar.gz
inkscape-9b424870613f4b345cf64bdfcb03889077a0597a.zip
Add checkbox for LPEs to temporarily disable them on canvas (but keep them applied to the object)
(bzr r5711)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/effect.cpp2
-rw-r--r--src/live_effects/effect.h7
-rw-r--r--src/object-edit.cpp1
-rw-r--r--src/shape-editor.cpp3
-rw-r--r--src/sp-lpe-item.cpp6
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<Parameter *>(&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<EffectType> LPETypeData[INVALID_LPE];
extern const Util::EnumDataConverter<EffectType> 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<Parameter *> param_vector;
std::vector<std::pair<SPKnotHolderSetFunc, SPKnotHolderGetFunc> > 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;