Code

Rename LPE: mirror reflect --> mirror symmetry
[inkscape.git] / src / live_effects / effect.h
index c46c145b58afcf8c6455104f2f0c1f10f09c13c0..dc5d6ec4a1fb6fcdfa18be85b71fcb5123daa13b 100644 (file)
@@ -14,6 +14,7 @@
 #include <map>
 #include <glibmm/ustring.h>
 #include <2geom/path.h>
+#include <2geom/forward.h>
 #include "ui/widget/registry.h"
 #include "util/enums.h"
 #include "sp-lpe-item.h"
@@ -27,6 +28,7 @@
 struct SPDocument;
 struct SPDesktop;
 struct SPItem;
+class SPNodeContext;
 class NArtBpath;
 struct LivePathEffectObject;
 
@@ -36,10 +38,6 @@ namespace Gtk {
     class Tooltips;
 }
 
-namespace Geom {
-    class Matrix;
-}
-
 namespace Inkscape {
 
 namespace XML {
@@ -71,12 +69,24 @@ enum EffectType {
     CONSTRUCT_GRID,
     PERP_BISECTOR,
     TANGENT_TO_CURVE,
+    MIRROR_SYMMETRY,
+    CIRCLE_3PTS,
+    ANGLE_BISECTOR,
+    PARALLEL,
+    COPY_ROTATE,
+    OFFSET,
     INVALID_LPE // This must be last
 };
 
 extern const Util::EnumData<EffectType> LPETypeData[INVALID_LPE];
 extern const Util::EnumDataConverter<EffectType> LPETypeConverter;
 
+enum LPEPathFlashType {
+    SUPPRESS_FLASH,
+//    PERMANENT_FLASH,
+    DEFAULT
+};
+
 class Effect {
 public:
     static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj);
@@ -88,9 +98,16 @@ public:
     EffectType effectType ();
 
     virtual void doOnApply (SPLPEItem *lpeitem);
-
     virtual void doBeforeEffect (SPLPEItem *lpeitem);
 
+    void writeParamsToSVG();
+
+    virtual void acceptParamPath (SPPath *param_path);
+    virtual int acceptsNumParams() { return 0; }
+    void doAcceptPathPreparations(SPLPEItem *lpeitem);
+
+    inline bool pathParamAccepted() { return done_pathparam_set; }
+
     virtual void doEffect (SPCurve * curve);
 
     virtual Gtk::Widget * newWidget(Gtk::Tooltips * tooltips);
@@ -101,9 +118,20 @@ public:
 
     virtual void transform_multiply(Geom::Matrix const& postmul, bool set);
 
-    virtual bool providesKnotholder() { return false; }
+    // TODO: providesKnotholder() is currently used as an indicator of whether a nodepath is
+    // created for an item or not. When we allow both at the same time, this needs rethinking!
+    bool providesKnotholder();
+    // TODO: in view of providesOwnFlashPaths() below, this is somewhat redundant
+    //       (but spiro lpe still needs it!)
+    virtual LPEPathFlashType pathFlashType() { return DEFAULT; }
+    void addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
     void addPointParamHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
-    virtual void addKnotHolderHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
+
+    void addHelperPaths(SPLPEItem *lpeitem, SPDesktop *desktop);
+    inline bool providesOwnFlashPaths() {
+        return provides_own_flash_paths || show_orig_path;
+    }
+    inline bool showOrigPath() { return show_orig_path; }
 
     Glib::ustring          getName();
     Inkscape::XML::Node *  getRepr();
@@ -132,12 +160,19 @@ protected:
             doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
 
     void registerParameter(Parameter * param);
-    void registerKnotHolderHandle(SPKnotHolderSetFunc set_func, SPKnotHolderGetFunc get_func);
+    void registerKnotHolderHandle(KnotHolderEntity* entity, const char* descr);
     Parameter * getNextOncanvasEditableParam();
 
+    virtual void addHelperPathsImpl(SPLPEItem *lpeitem, SPDesktop *desktop);
+
     std::vector<Parameter *> param_vector;
+    std::vector<std::pair<KnotHolderEntity*, const char*> > kh_entity_vector;
     int oncanvasedit_it;
     BoolParam is_visible;
+    bool done_pathparam_set;
+
+    bool show_orig_path; // set this to true in derived effects to automatically have the original
+                         // path displayed as helperpath
 
     Inkscape::UI::Widget::Registry wr;
 
@@ -148,6 +183,8 @@ protected:
     bool concatenate_before_pwd2;
 
 private:
+    bool provides_own_flash_paths; // if true, the standard flash path is suppressed
+
     Effect(const Effect&);
     Effect& operator=(const Effect&);
 };
@@ -157,3 +194,14 @@ private:
 } //namespace Inkscape
 
 #endif
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :