summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter/transformedpoint.h
blob: c96bedb539427f0ad39e853c72b3e96dcf2913bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_TRANSFORMED_POINT_H
#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_TRANSFORMED_POINT_H

/*
 * Inkscape::LivePathEffectParameters
 *
 * Copyright (C) Theodore Janeczko 2012 <flutterguy317@gmail.com>
 *
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#include <glib.h>
#include <2geom/point.h>

#include "live_effects/parameter/parameter.h"

#include "knot-holder-entity.h"

namespace Inkscape {

namespace LivePathEffect {


class TransformedPointParam : public Parameter {
public:
    TransformedPointParam( const Glib::ustring& label,
                const Glib::ustring& tip,
                const Glib::ustring& key,
                Inkscape::UI::Widget::Registry* wr,
                Effect* effect,
                Geom::Point default_vector = Geom::Point(1,0),
                bool dontTransform = false);
    virtual ~TransformedPointParam();

    virtual Gtk::Widget * param_newWidget();
    inline const gchar *handleTip() const { return param_tooltip.c_str(); }

    virtual bool param_readSVGValue(const gchar * strvalue);
    virtual gchar * param_getSVGValue() const;

    Geom::Point getVector() const { return vector; };
    Geom::Point getOrigin() const { return origin; };
    void setValues(Geom::Point const &new_origin, Geom::Point const &new_vector) { setVector(new_vector); setOrigin(new_origin); };
    void setVector(Geom::Point const &new_vector) { vector = new_vector; };
    void setOrigin(Geom::Point const &new_origin) { origin = new_origin; };
    virtual void param_set_default();

    void set_and_write_new_values(Geom::Point const &new_origin, Geom::Point const &new_vector);

    virtual void param_transform_multiply(Geom::Affine const &postmul, bool set);

    void set_vector_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
    void set_oncanvas_color(guint32 color);

    virtual bool providesKnotHolderEntities() const { return true; }
    virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);

private:
    TransformedPointParam(const TransformedPointParam&);
    TransformedPointParam& operator=(const TransformedPointParam&);

    Geom::Point defvalue;

    Geom::Point origin;
    Geom::Point vector;

    bool noTransform;
    
    /// The looks of the vector and origin knots oncanvas
    SPKnotShapeType vec_knot_shape;
    SPKnotModeType  vec_knot_mode;
    guint32         vec_knot_color;

    friend class TransformedPointParamKnotHolderEntity_Vector;
};


} //namespace LivePathEffect

} //namespace Inkscape

#endif