diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2014-12-23 09:25:08 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2014-12-23 09:25:08 +0000 |
| commit | f01a18216e26fd87a53188018e03527c7fdf8a57 (patch) | |
| tree | e5fc50bfa2b278d007659dd0aa4c6587414731dd /src/sp-shape.cpp | |
| parent | Bug #1380413: make sure that the rect toolbar knows when and when not to update (diff) | |
| download | inkscape-f01a18216e26fd87a53188018e03527c7fdf8a57.tar.gz inkscape-f01a18216e26fd87a53188018e03527c7fdf8a57.zip | |
Use gray for 'context-fill' and 'context-stroke' in marker selector.
Fix rendering bug when elements with 'context-fill' and 'context-stroke' are inside groups.
(bzr r13822)
Diffstat (limited to 'src/sp-shape.cpp')
| -rw-r--r-- | src/sp-shape.cpp | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 02b9969b3..16f9ec13b 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -126,6 +126,7 @@ Inkscape::XML::Node* SPShape::write(Inkscape::XML::Document *xml_doc, Inkscape:: } void SPShape::update(SPCtx* ctx, guint flags) { + // std::cout << "SPShape::update(): " << (getId()?getId():"null") << std::endl; SPLPEItem::update(ctx, flags); /* This stanza checks that an object's marker style agrees with @@ -146,10 +147,13 @@ void SPShape::update(SPCtx* ctx, guint flags) { for (SPItemView *v = ((SPItem *) (this))->display; v != NULL; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem); if (hasMarkers()) { - sh->setStyle(this->style, this->style); - sh->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children. - } else { - sh->setStyle(this->style, this->parent->style); + this->context_style = this->style; + sh->setStyle(this->style, this->context_style); + // Done at end: + // sh->setChildrenStyle(this->context_style); //Resolve 'context-xxx' in children. + } else if (this->parent) { + this->context_style = this->parent->context_style; + sh->setStyle(this->style, this->context_style); } } } @@ -188,6 +192,13 @@ void SPShape::update(SPCtx* ctx, guint flags) { for (SPItemView *v = this->display; v != NULL; v = v->next) { sp_shape_update_marker_view (this, v->arenaitem); } + + // Marker selector needs this here or marker previews are not rendered. + for (SPItemView *v = this->display; v != NULL; v = v->next) { + Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem); + + sh->setChildrenStyle(this->context_style); // Resolve 'context-xxx' in children. + } } } @@ -388,16 +399,22 @@ sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai) } void SPShape::modified(unsigned int flags) { + // std::cout << "SPShape::modified(): " << (getId()?getId():"null") << std::endl; SPLPEItem::modified(flags); if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem); if (hasMarkers()) { - sh->setStyle(this->style, this->style); - sh->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children. - } else { - sh->setStyle(this->style, this->parent->style); + this->context_style = this->style; + sh->setStyle(this->style, this->context_style); + // Note: marker selector preview does not trigger SP_OBJECT_STYLE_MODIFIED_FLAG so + // this is not called when marker previews are generated, however there is code in + // SPShape::update() that calls this routine so we don't worry about it here. + sh->setChildrenStyle(this->context_style); // Resolve 'context-xxx' in children. + } else if (this->parent) { + this->context_style = this->parent->context_style; + sh->setStyle(this->style, this->context_style); } } } @@ -729,6 +746,7 @@ void SPShape::print(SPPrintContext* ctx) { } Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /*key*/, unsigned int /*flags*/) { + // std::cout << "SPShape::show(): " << (getId()?getId():"null") << std::endl; Inkscape::DrawingShape *s = new Inkscape::DrawingShape(drawing); bool has_markers = this->hasMarkers(); @@ -761,10 +779,12 @@ Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /* /* Update marker views */ sp_shape_update_marker_view (this, s); - s->setStyle(this->style,this->style); - s->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children. - } else { - s->setStyle(this->style, this->parent->style); + this->context_style = this->style; + s->setStyle(this->style, this->context_style); + s->setChildrenStyle(this->context_style); // Resolve 'context-xxx' in children. + } else if (this->parent) { + this->context_style = this->parent->context_style; + s->setStyle(this->style, this->context_style); } return s; } |
