Code

+ Fix bug #179840, forking of LPEs
[inkscape.git] / src / sp-shape.h
1 #ifndef __SP_SHAPE_H__
2 #define __SP_SHAPE_H__
4 /*
5  * Base class for shapes, including <path> element
6  *
7  * Author:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *
10  * Copyright (C) 1999-2002 Lauris Kaplinski
11  * Copyright (C) 2000-2001 Ximian, Inc.
12  * Copyright (C) 2008 Johan Engelen
13  *
14  * Released under GNU GPL, read the file 'COPYING' for more information
15  */
17 #include "display/display-forward.h"
18 #include "sp-item.h"
19 #include "sp-marker-loc.h"
21 #include <sigc++/connection.h>
23 #define SP_TYPE_SHAPE (sp_shape_get_type ())
24 #define SP_SHAPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SHAPE, SPShape))
25 #define SP_SHAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SHAPE, SPShapeClass))
26 #define SP_IS_SHAPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SHAPE))
27 #define SP_IS_SHAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_SHAPE))
29 #define SP_SHAPE_WRITE_PATH (1 << 2)
31 struct SPDesktop;
32 struct LivePathEffectObject;
33 namespace Inkscape{ 
34 namespace LivePathEffect{
35     class LPEObjectReference;
36     class Effect;
37 };
38 };
41 struct SPShape : public SPItem {
42     SPCurve *curve;
44       SPObject *marker[SP_MARKER_LOC_QTY];
45       sigc::connection release_connect [SP_MARKER_LOC_QTY];
46       sigc::connection modified_connect [SP_MARKER_LOC_QTY];
48     gchar *path_effect_href;
49     Inkscape::LivePathEffect::LPEObjectReference *path_effect_ref;
50     sigc::connection lpe_modified_connection;
51 };
53 struct SPShapeClass {
54         SPItemClass item_class;
56         /* Build bpath from extra shape attributes */
57         void (* set_shape) (SPShape *shape);
59     void (* update_patheffect) (SPShape *shape, bool write);
60 };
62 GType sp_shape_get_type (void);
64 void sp_shape_set_shape (SPShape *shape);
66 /* Return duplicate of curve or NULL */
67 SPCurve *sp_shape_get_curve (SPShape *shape);
69 // sets a curve, updates display
70 void sp_shape_set_curve (SPShape *shape, SPCurve *curve, unsigned int owner);
72 // same as sp_shape_set_curve, but without updating display
73 void sp_shape_set_curve_insync (SPShape *shape, SPCurve *curve, unsigned int owner);
75 // markers API
76 void sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value);
77 int sp_shape_has_markers (SPShape const *shape);
78 int sp_shape_number_of_markers (SPShape* Shape, int type);
79 NR::Matrix sp_shape_marker_get_transform(SPShape const *shape, NArtBpath const *bp);
80 bool sp_shape_marker_required(SPShape const *shape, int const m, NArtBpath *bp);
82 LivePathEffectObject * sp_shape_get_livepatheffectobject(SPShape *shape);
83 Inkscape::LivePathEffect::Effect * sp_shape_get_livepatheffect(SPShape *shape);
84 void sp_shape_update_patheffect (SPShape *shape, bool write);
85 void sp_shape_perform_path_effect(SPCurve *curve, SPShape *shape);
87 void sp_shape_set_path_effect(SPShape *shape, gchar *value);
88 void sp_shape_set_path_effect(SPShape *shape, LivePathEffectObject * new_lpeobj);
89 void sp_shape_remove_path_effect(SPShape *shape);
90 bool sp_shape_has_path_effect(SPShape *shape);
92 void sp_shape_edit_next_param_oncanvas(SPShape *shape, SPDesktop *dt);
94 #endif