From f5651cf5d63c5eb3bfc0710f2ff399e3627a963c Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Fri, 5 Oct 2018 13:31:33 +0000 Subject: fix 1795942 "object to path" uses outdated state --- src/object/sp-clippath.cpp | 1 + src/object/sp-hatch-path.cpp | 1 + src/object/sp-hatch.cpp | 1 + src/object/sp-item.cpp | 1 + src/object/sp-solid-color.cpp | 1 + src/style.cpp | 10 ++++++++++ src/style.h | 5 +---- 7 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/object/sp-clippath.cpp b/src/object/sp-clippath.cpp index 21959af41..724c715ed 100644 --- a/src/object/sp-clippath.cpp +++ b/src/object/sp-clippath.cpp @@ -84,6 +84,7 @@ void SPClipPath::set(unsigned int key, const gchar* value) { break; default: if (SP_ATTRIBUTE_IS_CSS(key)) { + this->style->clear(key); this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPObjectGroup::set(key, value); diff --git a/src/object/sp-hatch-path.cpp b/src/object/sp-hatch-path.cpp index 8da149f75..60f186212 100644 --- a/src/object/sp-hatch-path.cpp +++ b/src/object/sp-hatch-path.cpp @@ -106,6 +106,7 @@ void SPHatchPath::set(unsigned int key, const gchar* value) default: if (SP_ATTRIBUTE_IS_CSS(key)) { + style->clear(key); requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPObject::set(key, value); diff --git a/src/object/sp-hatch.cpp b/src/object/sp-hatch.cpp index 5b6d034a9..5786fc98d 100644 --- a/src/object/sp-hatch.cpp +++ b/src/object/sp-hatch.cpp @@ -221,6 +221,7 @@ void SPHatch::set(unsigned int key, const gchar* value) default: if (SP_ATTRIBUTE_IS_CSS(key)) { + style->clear(key); requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPPaintServer::set(key, value); diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index d5c02709e..14dd4c5f2 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -518,6 +518,7 @@ void SPItem::set(unsigned int key, gchar const* value) { } default: if (SP_ATTRIBUTE_IS_CSS(key)) { + style->clear(key); object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPObject::set(key, value); diff --git a/src/object/sp-solid-color.cpp b/src/object/sp-solid-color.cpp index 1d973766e..f1d73835c 100644 --- a/src/object/sp-solid-color.cpp +++ b/src/object/sp-solid-color.cpp @@ -39,6 +39,7 @@ void SPSolidColor::build(SPDocument* doc, Inkscape::XML::Node* repr) { void SPSolidColor::set(unsigned int key, const gchar* value) { if (SP_ATTRIBUTE_IS_CSS(key)) { + style->clear(key); this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPPaintServer::set(key, value); diff --git a/src/style.cpp b/src/style.cpp index a4f567354..6d86e6a96 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -498,6 +498,16 @@ SPStyle::~SPStyle() { // std::cout << "SPStyle::~SPStyle(): Exit\n" << std::endl; } +void +SPStyle::clear(/* SPAttributeEnum */ int id) { + SPIBase *p = _prop_helper.get(this, (SPAttributeEnum)id); + if (p) { + p->clear(); + } else { + g_warning("Unimplemented style property %d", id); + } +} + void SPStyle::clear() { for (auto * p : _properties) { diff --git a/src/style.h b/src/style.h index 07dd329d6..fd45e02ea 100644 --- a/src/style.h +++ b/src/style.h @@ -29,9 +29,6 @@ // Define SPIBasePtr, a Pointer to a data member of SPStyle of type SPIBase; typedef SPIBase SPStyle::*SPIBasePtr; -// Define SPPropMap, a map linking property name to property data -// typedef std::map SPPropMap; - namespace Inkscape { namespace XML { class Node; @@ -47,6 +44,7 @@ public: SPStyle(SPDocument *document = nullptr, SPObject *object = nullptr);// document is ignored if valid object given ~SPStyle(); void clear(); + void clear(/* SPAttributeEnum */ int id); void read(SPObject *object, Inkscape::XML::Node *repr); void readFromObject(SPObject *object); void readFromPrefs(Glib::ustring const &path); @@ -84,7 +82,6 @@ public: private: /// Pointers to all the properties (for looping through them) std::vector _properties; - // static SPPropMap _propmap; public: -- cgit v1.2.3