summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: edfb6f4)
raw | patch | inline | side by side (parent: edfb6f4)
author | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 4 Jun 2008 13:12:05 +0000 (13:12 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 4 Jun 2008 13:12:05 +0000 (13:12 +0000) |
src/live_effects/effect.cpp | patch | blob | history | |
src/live_effects/effect.h | patch | blob | history | |
src/ui/dialog/livepatheffect-editor.cpp | patch | blob | history |
index 639ad93a48ee34ecf60eeb1e1d8028e14f2b7365..765d0a59bb2d21866dd48a27af8d63656d104b72 100644 (file)
#include "desktop.h"
#include "inkscape.h"
#include "document.h"
+#include "document-private.h"
+#include "xml/document.h"
#include <glibmm/i18n.h>
#include "live_effects/lpeobject.h"
return neweffect;
}
+void
+Effect::createAndApply(const char* name, SPDocument *doc, SPItem *item)
+{
+ // Path effect definition
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
+ Inkscape::XML::Node *repr = xml_doc->createElement("inkscape:path-effect");
+ repr->setAttribute("effect", name);
+
+ SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc))->addChild(repr, NULL); // adds to <defs> and assigns the 'id' attribute
+ const gchar * repr_id = repr->attribute("id");
+ Inkscape::GC::release(repr);
+
+ gchar *href = g_strdup_printf("#%s", repr_id);
+ sp_lpe_item_add_path_effect(SP_LPE_ITEM(item), href, true);
+ g_free(href);
+
+ sp_document_done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT,
+ _("Create and apply path effect"));
+}
+
+void
+Effect::createAndApply(EffectType type, SPDocument *doc, SPItem *item)
+{
+ createAndApply(LPETypeConverter.get_key(type).c_str(), doc, item);
+}
+
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),
index 6d72a56151f5ec2e834e6ea29da5195507e31fcd..c04f248e331a3716162a2859357e22001b75a032 100644 (file)
class Effect {
public:
static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj);
+ static void createAndApply(const char* name, SPDocument *doc, SPItem *item);
+ static void createAndApply(EffectType type, SPDocument *doc, SPItem *item);
virtual ~Effect();
index c92d015f53f1e67e41b7e66c3a942405ca00557c..2dc4fda71062dcd1259bbe597cd54640fb66809b 100644 (file)
#include "inkscape.h"
#include "desktop-handles.h"
#include "desktop.h"
-#include "document-private.h"
+#include "document.h"
#include "xml/node.h"
-#include "xml/document.h"
#include <gtkmm/stock.h>
#include <gtkmm/toolbar.h>
item = sel->singleItem(); // get new item
}
- // Path effect definition
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
- Inkscape::XML::Node *repr = xml_doc->createElement("inkscape:path-effect");
- repr->setAttribute("effect", data->key.c_str() );
-
- SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc))->addChild(repr, NULL); // adds to <defs> and assigns the 'id' attribute
- const gchar * repr_id = repr->attribute("id");
- Inkscape::GC::release(repr);
-
- gchar *href = g_strdup_printf("#%s", repr_id);
- sp_lpe_item_add_path_effect(SP_LPE_ITEM(item), href, true);
- g_free(href);
-
- sp_document_done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- _("Create and apply path effect"));
+ LivePathEffect::Effect::createAndApply(data->key.c_str(), doc, item);
onSelectionChanged(sel);
}