diff options
| author | Ted Gould <ted@gould.cx> | 2009-11-29 19:01:07 +0000 |
|---|---|---|
| committer | Ted Gould <ted@gould.cx> | 2009-11-29 19:01:07 +0000 |
| commit | 29d3c0b15028e61f176df3a75189bf0959d0d03e (patch) | |
| tree | 727afe596c693a9bdd098d72618abd9ceb0d1969 /src/sp-star.cpp | |
| parent | Add the build dir dbus directory to grab some headerfiles for distcheck. (diff) | |
| parent | hopefully fix build on linux (diff) | |
| download | inkscape-29d3c0b15028e61f176df3a75189bf0959d0d03e.tar.gz inkscape-29d3c0b15028e61f176df3a75189bf0959d0d03e.zip | |
Merging in from trunk
(bzr r8254.1.37)
Diffstat (limited to '')
| -rw-r--r-- | src/sp-star.cpp | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 3c8754a11..9cffd952c 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -28,6 +28,8 @@ #include "xml/repr.h" #include "document.h" +#include <2geom/pathvector.h> + #include "sp-star.h" static void sp_star_class_init (SPStarClass *klass); @@ -174,7 +176,7 @@ sp_star_set (SPObject *object, unsigned int key, const gchar *value) case SP_ATTR_SODIPODI_SIDES: if (value) { star->sides = atoi (value); - star->sides = CLAMP (star->sides, 3, 1024); + star->sides = NR_CLAMP(star->sides, 3, 1024); } else { star->sides = 5; } @@ -428,6 +430,21 @@ sp_star_set_shape (SPShape *shape) { SPStar *star = SP_STAR (shape); + // perhaps we should convert all our shapes into LPEs without source path + // and with knotholders for parameters, then this situation will be handled automatically + // by disabling the entire stack (including the shape LPE) + if (sp_lpe_item_has_broken_path_effect(SP_LPE_ITEM(shape))) { + g_warning ("The star shape has unknown LPE on it! Convert to path to make it editable preserving the appearance; editing it as star will remove the bad LPE"); + if (SP_OBJECT_REPR(shape)->attribute("d")) { + // unconditionally read the curve from d, if any, to preserve appearance + Geom::PathVector pv = sp_svg_read_pathv(SP_OBJECT_REPR(shape)->attribute("d")); + SPCurve *cold = new SPCurve(pv); + sp_shape_set_curve_insync (shape, cold, TRUE); + cold->unref(); + } + return; + } + SPCurve *c = new SPCurve (); gint sides = star->sides; @@ -500,7 +517,7 @@ sp_star_set_shape (SPShape *shape) bool success = sp_lpe_item_perform_path_effect(SP_LPE_ITEM (shape), c_lpe); if (success) { sp_shape_set_curve_insync (shape, c_lpe, TRUE); - } + } c_lpe->unref(); } c->unref(); @@ -512,13 +529,13 @@ sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, g_return_if_fail (star != NULL); g_return_if_fail (SP_IS_STAR (star)); - star->sides = CLAMP (sides, 3, 1024); + star->sides = NR_CLAMP(sides, 3, 1024); star->center = center; star->r[0] = MAX (r1, 0.001); if (isflat == false) { - star->r[1] = CLAMP (r2, 0.0, star->r[0]); + star->r[1] = NR_CLAMP(r2, 0.0, star->r[0]); } else { - star->r[1] = CLAMP ( r1*cos(M_PI/sides) ,0.0, star->r[0] ); + star->r[1] = NR_CLAMP( r1*cos(M_PI/sides) ,0.0, star->r[0] ); } star->arg[0] = arg1; star->arg[1] = arg2; @@ -587,3 +604,13 @@ sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized) } } +/* + 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:encoding=utf-8:textwidth=99 : |
