#ifndef INKSCAPE_LIVEPATHEFFECT_H #define INKSCAPE_LIVEPATHEFFECT_H /* * Inkscape::LivePathEffect * * Copyright (C) Johan Engelen 2007-2008 * * Released under GNU GPL, read the file 'COPYING' for more information */ #include "display/display-forward.h" #include #include #include <2geom/path.h> #include "ui/widget/registry.h" #include "util/enums.h" #include "sp-lpe-item.h" #define LPE_CONVERSION_TOLERANCE 0.01 // FIXME: find good solution for this. #define LPE_ENABLE_TEST_EFFECTS struct SPDocument; struct SPDesktop; struct SPItem; class NArtBpath; struct LivePathEffectObject; namespace Gtk { class Widget; class VBox; class Tooltips; } namespace Geom { class Matrix; } namespace Inkscape { namespace XML { class Node; } namespace NodePath { class Path ; } namespace LivePathEffect { enum EffectType { BEND_PATH = 0, PATTERN_ALONG_PATH, SKETCH, VONKOCH, KNOT, #ifdef LPE_ENABLE_TEST_EFFECTS DOEFFECTSTACK_TEST, #endif GEARS, CURVE_STITCH, CIRCLE_WITH_RADIUS, PERSPECTIVE_PATH, SPIRO, CONSTRUCT_GRID, INVALID_LPE // This must be last }; extern const Util::EnumData LPETypeData[INVALID_LPE]; extern const Util::EnumDataConverter LPETypeConverter; class Parameter; class Effect { public: static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj); virtual ~Effect(); virtual void doBeforeEffect (SPLPEItem *lpeitem); virtual void doEffect (SPCurve * curve); virtual Gtk::Widget * newWidget(Gtk::Tooltips * tooltips); virtual void resetDefaults(SPItem * item); virtual void setup_nodepath(Inkscape::NodePath::Path *np); virtual void transform_multiply(Geom::Matrix const& postmul, bool set); Glib::ustring getName(); Inkscape::XML::Node * getRepr(); SPDocument * getSPDoc(); LivePathEffectObject * getLPEObj() {return lpeobj;}; Parameter * getParameter(const char * key); void readallParameters(Inkscape::XML::Node * repr); void setParameter(const gchar * key, const gchar * new_value); void editNextParamOncanvas(SPItem * item, SPDesktop * desktop); protected: Effect(LivePathEffectObject *lpeobject); // provide a set of doEffect functions so the developer has a choice // of what kind of input/output parameters he desires. // the order in which they appear is the order in which they are // called by this base class. (i.e. doEffect(SPCurve * curve) defaults to calling // doEffect(std::vector ) virtual NArtBpath * doEffect_nartbpath (NArtBpath const * path_in) __attribute__ ((deprecated)); virtual std::vector doEffect_path (std::vector const & path_in); virtual Geom::Piecewise > doEffect_pwd2 (Geom::Piecewise > const & pwd2_in); void registerParameter(Parameter * param); Parameter * getNextOncanvasEditableParam(); std::vector param_vector; int oncanvasedit_it; Inkscape::UI::Widget::Registry wr; LivePathEffectObject *lpeobj; // this boolean defaults to false, it concatenates the input path to one pwd2, // instead of normally 'splitting' the path into continuous pwd2 paths. bool concatenate_before_pwd2; private: Effect(const Effect&); Effect& operator=(const Effect&); }; } //namespace LivePathEffect } //namespace Inkscape #endif