diff options
Diffstat (limited to 'src/object/sp-path.cpp')
| -rw-r--r-- | src/object/sp-path.cpp | 79 |
1 files changed, 17 insertions, 62 deletions
diff --git a/src/object/sp-path.cpp b/src/object/sp-path.cpp index b4e9f7559..a0c7f098d 100644 --- a/src/object/sp-path.cpp +++ b/src/object/sp-path.cpp @@ -21,32 +21,29 @@ #include <glibmm/i18n.h> -#include <2geom/curves.h> +#include "live_effects/effect.h" +#include "live_effects/lpeobject.h" +#include "live_effects/lpeobject-reference.h" +#include "sp-lpe-item.h" -#include "attributes.h" -#include "desktop-style.h" -#include "desktop.h" #include "display/curve.h" -#include "document.h" -#include "inkscape.h" -#include "style.h" - +#include <2geom/curves.h> #include "helper/geom-curves.h" -#include "live_effects/effect.h" -#include "live_effects/lpeobject-reference.h" -#include "live_effects/lpeobject.h" +#include "svg/svg.h" +#include "xml/repr.h" +#include "attributes.h" -#include "sp-guide.h" -#include "sp-lpe-item.h" #include "sp-path.h" +#include "sp-guide.h" -#include "svg/svg.h" +#include "document.h" +#include "desktop.h" +#include "desktop-style.h" #include "ui/tools/tool-base.h" - -#include "xml/repr.h" -#include "xml/sp-css-attr.h" +#include "inkscape.h" +#include "style.h" #define noPATH_VERBOSE @@ -112,18 +109,13 @@ void SPPath::convert_to_guides() const { sp_guide_pt_pairs_to_guides(this->document, pts); } -SPPath::SPPath() - : SPShape() - , connEndPair(this) - , d_source( SP_STYLE_SRC_UNSET ) -{ +SPPath::SPPath() : SPShape(), connEndPair(this) { } SPPath::~SPPath() { } void SPPath::build(SPDocument *document, Inkscape::XML::Node *repr) { - /* Are these calls actually necessary? */ this->readAttr( "marker" ); this->readAttr( "marker-start" ); @@ -172,6 +164,7 @@ void SPPath::build(SPDocument *document, Inkscape::XML::Node *repr) { /* d is a required attribute */ char const *d = this->getAttribute("d", NULL); + if (d == NULL) { // First see if calculating the path effect will generate "d": this->update_patheffect(true); @@ -180,11 +173,8 @@ void SPPath::build(SPDocument *document, Inkscape::XML::Node *repr) { // I guess that didn't work, now we have nothing useful to write ("") if (d == NULL) { this->setKeyValue( sp_attribute_lookup("d"), ""); - } else { - d_source = SP_STYLE_SRC_ATTRIBUTE; } } - } void SPPath::release() { @@ -285,46 +275,10 @@ g_message("sp_path_write writes 'd' attribute"); } void SPPath::update(SPCtx *ctx, guint flags) { - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // since we change the description, it's not a "just translation" anymore } - // Our code depends on 'd' being an attribute (LPE's, etc.). To support 'd' as a property, we - // check it here (after the style property has been evaluated, this allows us to properly - // handled precedence of property vs attribute). If we read in a 'd' set by styling, convert it - // to an attribute. We'll convert it back on output. - - d_source = style->d.style_src; - - if (style->d.set && - - (d_source == SP_STYLE_SRC_STYLE_PROP | d_source == SP_STYLE_SRC_STYLE_SHEET) ) { - - if (style->d.value) { - - Geom::PathVector pv = sp_svg_read_pathv(style->d.value); - SPCurve *curve = new SPCurve(pv); - if (curve) { - - // Update curve - this->setCurveInsync(curve, TRUE); - curve->unref(); - - // Convert from property to attribute (convert back on write) - getRepr()->setAttribute("d", style->d.value); - - SPCSSAttr *css = sp_repr_css_attr( getRepr(), "style"); - sp_repr_css_unset_property ( css, "d"); - sp_repr_css_set ( getRepr(), css, "style" ); - sp_repr_css_attr_unref ( css ); - - } else { - // Do nothing... don't overwrite 'd' from attribute - } - } - } - SPShape::update(ctx, flags); this->connEndPair.update(); @@ -417,6 +371,7 @@ g_message("sp_path_update_patheffect writes 'd' attribute"); } } + /** * Adds a original_curve to the path. If owner is specified, a reference * will be made, otherwise the curve will be copied into the path. |
