From 058e95a59ccb2ab1748392acdfdbbffd516c9c81 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Mon, 11 Jul 2016 14:24:52 +0200 Subject: First part of new SPObject children list (bzr r14954.1.17) --- src/sp-item.cpp | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 9fd6e8ecc..258a5cd14 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -308,50 +308,35 @@ bool is_item(SPObject const &object) { void SPItem::raiseToTop() { using Inkscape::Algorithms::find_last_if; - SPObject *topmost=find_last_if( - next, NULL, &is_item - ); - if (topmost) { + auto topmost = find_last_if(++parent->_children.iterator_to(*this), parent->_children.end(), &is_item); + if (topmost != parent->_children.end()) { getRepr()->parent()->changeOrder( getRepr(), topmost->getRepr() ); } } void SPItem::raiseOne() { - SPObject *next_higher=std::find_if( - next, NULL, &is_item - ); - if (next_higher) { + auto next_higher = std::find_if(++parent->_children.iterator_to(*this), parent->_children.end(), &is_item); + if (next_higher != parent->_children.end()) { Inkscape::XML::Node *ref = next_higher->getRepr(); getRepr()->parent()->changeOrder(getRepr(), ref); } } void SPItem::lowerOne() { - using Inkscape::Util::MutableList; - using Inkscape::Util::reverse_list; - - MutableList next_lower=std::find_if( - reverse_list( - parent->firstChild(), this - ), - MutableList(), - &is_item - ); - if (next_lower) { - ++next_lower; - Inkscape::XML::Node *ref = ( next_lower ? next_lower->getRepr() : NULL ); + using Inkscape::Algorithms::find_last_if; + + auto next_lower = find_last_if(parent->_children.begin(), parent->_children.iterator_to(*this), &is_item); + if (next_lower != parent->_children.iterator_to(*this)) { + next_lower--; + Inkscape::XML::Node *ref = next_lower->getRepr(); getRepr()->parent()->changeOrder(getRepr(), ref); } } void SPItem::lowerToBottom() { - using Inkscape::Algorithms::find_last_if; - using Inkscape::Util::MutableList; - using Inkscape::Util::reverse_list; - - SPObject * bottom=parent->firstChild(); - while(dynamic_cast(bottom) && dynamic_cast(bottom->next) && bottom!=this && !is_item(*(bottom->next))) bottom=bottom->next; - if (bottom && bottom != this) { + auto bottom = std::find_if(parent->_children.begin(), parent->_children.iterator_to(*this), &is_item); + if (bottom != parent->_children.iterator_to(*this)) { + bottom--; Inkscape::XML::Node *ref = bottom->getRepr() ; parent->getRepr()->changeOrder(getRepr(), ref); } -- cgit v1.2.3 From d1947e768272c703674129d5c583204ff2b59251 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 13 Jul 2016 13:36:19 +0200 Subject: Second part of new SPObject children list (bzr r14954.1.19) --- src/sp-item.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 258a5cd14..ba57cec8b 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -705,9 +705,9 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X // so we need to add any children from the underlying object to the new repr if (flags & SP_OBJECT_WRITE_BUILD) { GSList *l = NULL; - for (SPObject *child = object->firstChild(); child != NULL; child = child->next ) { - if (dynamic_cast(child) || dynamic_cast(child)) { - Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags); + for (auto& child: object->_children) { + if (dynamic_cast(&child) || dynamic_cast(&child)) { + Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags); if (crepr) { l = g_slist_prepend (l, crepr); } @@ -719,9 +719,9 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X l = g_slist_remove (l, l->data); } } else { - for (SPObject *child = object->firstChild() ; child != NULL; child = child->next ) { - if (dynamic_cast(child) || dynamic_cast(child)) { - child->updateRepr(flags); + for (auto& child: object->_children) { + if (dynamic_cast(&child) || dynamic_cast(&child)) { + child.updateRepr(flags); } } } @@ -928,12 +928,12 @@ unsigned int SPItem::pos_in_parent() const { unsigned int pos = 0; - for ( SPObject *iter = parent->firstChild() ; iter ; iter = iter->next) { - if (iter == this) { + for (auto& iter: parent->_children) { + if (&iter == this) { return pos; } - if (dynamic_cast(iter)) { + if (dynamic_cast(&iter)) { pos++; } } @@ -1666,8 +1666,8 @@ SPItem const *sp_item_first_item_child(SPObject const *obj) SPItem *sp_item_first_item_child(SPObject *obj) { SPItem *child = 0; - for ( SPObject *iter = obj->firstChild() ; iter ; iter = iter->next ) { - SPItem *tmp = dynamic_cast(iter); + for (auto& iter: obj->_children) { + SPItem *tmp = dynamic_cast(&iter); if ( tmp ) { child = tmp; break; -- cgit v1.2.3 From 9e210a6d1333c3366681547e3e81593ef69ff73e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 12:56:49 +0200 Subject: Last part of new SPObject children list (bzr r14954.1.20) --- src/sp-item.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index ba57cec8b..53b4c0879 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -351,8 +351,8 @@ void SPItem::moveTo(SPItem *target, bool intoafter) { // Assume move to the "first" in the top node, find the top node intoafter = false; SPObject* bottom = this->document->getObjectByRepr(our_ref->root())->firstChild(); - while(!dynamic_cast(bottom->next)){ - bottom=bottom->next; + while(!dynamic_cast(bottom->getNext())){ + bottom = bottom->getNext(); } target_ref = bottom->getRepr(); } @@ -974,8 +974,8 @@ void SPItem::getSnappoints(std::vector &p, Inkscap for (std::list::const_iterator o = clips_and_masks.begin(); o != clips_and_masks.end(); ++o) { if (*o) { // obj is a group object, the children are the actual clippers - for (SPObject *child = (*o)->children ; child ; child = child->next) { - SPItem *item = dynamic_cast(child); + for(auto& child: (*o)->_children) { + SPItem *item = dynamic_cast(const_cast(&child)); if (item) { std::vector p_clip_or_mask; // Please note the recursive call here! @@ -1302,8 +1302,8 @@ void SPItem::adjust_stroke_width_recursive(double expansion) // A clone's child is the ghost of its original - we must not touch it, skip recursion if ( !dynamic_cast(this) ) { - for ( SPObject *o = children; o; o = o->getNext() ) { - SPItem *item = dynamic_cast(o); + for (auto& o: _children) { + SPItem *item = dynamic_cast(&o); if (item) { item->adjust_stroke_width_recursive(expansion); } @@ -1317,8 +1317,8 @@ void SPItem::freeze_stroke_width_recursive(bool freeze) // A clone's child is the ghost of its original - we must not touch it, skip recursion if ( !dynamic_cast(this) ) { - for ( SPObject *o = children; o; o = o->getNext() ) { - SPItem *item = dynamic_cast(o); + for (auto& o: _children) { + SPItem *item = dynamic_cast(&o); if (item) { item->freeze_stroke_width_recursive(freeze); } @@ -1337,10 +1337,10 @@ sp_item_adjust_rects_recursive(SPItem *item, Geom::Affine advertized_transform) rect->compensateRxRy(advertized_transform); } - for (SPObject *o = item->children; o != NULL; o = o->next) { - SPItem *item = dynamic_cast(o); - if (item) { - sp_item_adjust_rects_recursive(item, advertized_transform); + for(auto& o: item->_children) { + SPItem *itm = dynamic_cast(&o); + if (itm) { + sp_item_adjust_rects_recursive(itm, advertized_transform); } } } @@ -1357,8 +1357,8 @@ void SPItem::adjust_paint_recursive (Geom::Affine advertized_transform, Geom::Af // also we do not recurse into clones, because a clone's child is the ghost of its original - // we must not touch it if (!(this && (dynamic_cast(this) || dynamic_cast(this)))) { - for (SPObject *o = children; o != NULL; o = o->next) { - SPItem *item = dynamic_cast(o); + for (auto& o: _children) { + SPItem *item = dynamic_cast(&o); if (item) { // At the level of the transformed item, t_ancestors is identity; // below it, it is the accmmulated chain of transforms from this level to the top level -- cgit v1.2.3 From 24d3f50003ca3cec6a03a7f5267cc4fe5588c69f Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 13:17:21 +0200 Subject: Renamed children list in SPObject (bzr r14954.1.21) --- src/sp-item.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 53b4c0879..69da28c66 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -308,15 +308,15 @@ bool is_item(SPObject const &object) { void SPItem::raiseToTop() { using Inkscape::Algorithms::find_last_if; - auto topmost = find_last_if(++parent->_children.iterator_to(*this), parent->_children.end(), &is_item); - if (topmost != parent->_children.end()) { + auto topmost = find_last_if(++parent->children.iterator_to(*this), parent->children.end(), &is_item); + if (topmost != parent->children.end()) { getRepr()->parent()->changeOrder( getRepr(), topmost->getRepr() ); } } void SPItem::raiseOne() { - auto next_higher = std::find_if(++parent->_children.iterator_to(*this), parent->_children.end(), &is_item); - if (next_higher != parent->_children.end()) { + auto next_higher = std::find_if(++parent->children.iterator_to(*this), parent->children.end(), &is_item); + if (next_higher != parent->children.end()) { Inkscape::XML::Node *ref = next_higher->getRepr(); getRepr()->parent()->changeOrder(getRepr(), ref); } @@ -325,8 +325,8 @@ void SPItem::raiseOne() { void SPItem::lowerOne() { using Inkscape::Algorithms::find_last_if; - auto next_lower = find_last_if(parent->_children.begin(), parent->_children.iterator_to(*this), &is_item); - if (next_lower != parent->_children.iterator_to(*this)) { + auto next_lower = find_last_if(parent->children.begin(), parent->children.iterator_to(*this), &is_item); + if (next_lower != parent->children.iterator_to(*this)) { next_lower--; Inkscape::XML::Node *ref = next_lower->getRepr(); getRepr()->parent()->changeOrder(getRepr(), ref); @@ -334,8 +334,8 @@ void SPItem::lowerOne() { } void SPItem::lowerToBottom() { - auto bottom = std::find_if(parent->_children.begin(), parent->_children.iterator_to(*this), &is_item); - if (bottom != parent->_children.iterator_to(*this)) { + auto bottom = std::find_if(parent->children.begin(), parent->children.iterator_to(*this), &is_item); + if (bottom != parent->children.iterator_to(*this)) { bottom--; Inkscape::XML::Node *ref = bottom->getRepr() ; parent->getRepr()->changeOrder(getRepr(), ref); @@ -705,7 +705,7 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X // so we need to add any children from the underlying object to the new repr if (flags & SP_OBJECT_WRITE_BUILD) { GSList *l = NULL; - for (auto& child: object->_children) { + for (auto& child: object->children) { if (dynamic_cast(&child) || dynamic_cast(&child)) { Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags); if (crepr) { @@ -719,7 +719,7 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X l = g_slist_remove (l, l->data); } } else { - for (auto& child: object->_children) { + for (auto& child: object->children) { if (dynamic_cast(&child) || dynamic_cast(&child)) { child.updateRepr(flags); } @@ -928,7 +928,7 @@ unsigned int SPItem::pos_in_parent() const { unsigned int pos = 0; - for (auto& iter: parent->_children) { + for (auto& iter: parent->children) { if (&iter == this) { return pos; } @@ -974,7 +974,7 @@ void SPItem::getSnappoints(std::vector &p, Inkscap for (std::list::const_iterator o = clips_and_masks.begin(); o != clips_and_masks.end(); ++o) { if (*o) { // obj is a group object, the children are the actual clippers - for(auto& child: (*o)->_children) { + for(auto& child: (*o)->children) { SPItem *item = dynamic_cast(const_cast(&child)); if (item) { std::vector p_clip_or_mask; @@ -1302,7 +1302,7 @@ void SPItem::adjust_stroke_width_recursive(double expansion) // A clone's child is the ghost of its original - we must not touch it, skip recursion if ( !dynamic_cast(this) ) { - for (auto& o: _children) { + for (auto& o: children) { SPItem *item = dynamic_cast(&o); if (item) { item->adjust_stroke_width_recursive(expansion); @@ -1317,7 +1317,7 @@ void SPItem::freeze_stroke_width_recursive(bool freeze) // A clone's child is the ghost of its original - we must not touch it, skip recursion if ( !dynamic_cast(this) ) { - for (auto& o: _children) { + for (auto& o: children) { SPItem *item = dynamic_cast(&o); if (item) { item->freeze_stroke_width_recursive(freeze); @@ -1337,7 +1337,7 @@ sp_item_adjust_rects_recursive(SPItem *item, Geom::Affine advertized_transform) rect->compensateRxRy(advertized_transform); } - for(auto& o: item->_children) { + for(auto& o: item->children) { SPItem *itm = dynamic_cast(&o); if (itm) { sp_item_adjust_rects_recursive(itm, advertized_transform); @@ -1357,7 +1357,7 @@ void SPItem::adjust_paint_recursive (Geom::Affine advertized_transform, Geom::Af // also we do not recurse into clones, because a clone's child is the ghost of its original - // we must not touch it if (!(this && (dynamic_cast(this) || dynamic_cast(this)))) { - for (auto& o: _children) { + for (auto& o: children) { SPItem *item = dynamic_cast(&o); if (item) { // At the level of the transformed item, t_ancestors is identity; @@ -1666,7 +1666,7 @@ SPItem const *sp_item_first_item_child(SPObject const *obj) SPItem *sp_item_first_item_child(SPObject *obj) { SPItem *child = 0; - for (auto& iter: obj->_children) { + for (auto& iter: obj->children) { SPItem *tmp = dynamic_cast(&iter); if ( tmp ) { child = tmp; -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/sp-item.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 9fd6e8ecc..01cb2d09f 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include "sp-item.h" @@ -33,19 +33,14 @@ #include "sp-clippath.h" #include "sp-mask.h" #include "sp-rect.h" -#include "sp-use.h" #include "sp-text.h" #include "sp-textpath.h" #include "sp-item-rm-unsatisfied-cns.h" #include "sp-pattern.h" -#include "sp-paint-server.h" #include "sp-switch.h" -#include "sp-guide-constraint.h" #include "gradient-chemistry.h" -#include "preferences.h" #include "conn-avoid-ref.h" #include "conditions.h" -#include "sp-filter-reference.h" #include "filter-chemistry.h" #include "sp-guide.h" #include "sp-title.h" @@ -53,13 +48,8 @@ #include "util/find-last-if.h" #include "util/reverse-list.h" -#include <2geom/rect.h> -#include <2geom/affine.h> -#include <2geom/transforms.h> -#include "xml/repr.h" #include "extract-uri.h" -#include "helper/geom.h" #include "live_effects/lpeobject.h" #include "live_effects/effect.h" -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/sp-item.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 01cb2d09f..9fd6e8ecc 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include "sp-item.h" @@ -33,14 +33,19 @@ #include "sp-clippath.h" #include "sp-mask.h" #include "sp-rect.h" +#include "sp-use.h" #include "sp-text.h" #include "sp-textpath.h" #include "sp-item-rm-unsatisfied-cns.h" #include "sp-pattern.h" +#include "sp-paint-server.h" #include "sp-switch.h" +#include "sp-guide-constraint.h" #include "gradient-chemistry.h" +#include "preferences.h" #include "conn-avoid-ref.h" #include "conditions.h" +#include "sp-filter-reference.h" #include "filter-chemistry.h" #include "sp-guide.h" #include "sp-title.h" @@ -48,8 +53,13 @@ #include "util/find-last-if.h" #include "util/reverse-list.h" +#include <2geom/rect.h> +#include <2geom/affine.h> +#include <2geom/transforms.h> +#include "xml/repr.h" #include "extract-uri.h" +#include "helper/geom.h" #include "live_effects/lpeobject.h" #include "live_effects/effect.h" -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/sp-item.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 9fd6e8ecc..01cb2d09f 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include "sp-item.h" @@ -33,19 +33,14 @@ #include "sp-clippath.h" #include "sp-mask.h" #include "sp-rect.h" -#include "sp-use.h" #include "sp-text.h" #include "sp-textpath.h" #include "sp-item-rm-unsatisfied-cns.h" #include "sp-pattern.h" -#include "sp-paint-server.h" #include "sp-switch.h" -#include "sp-guide-constraint.h" #include "gradient-chemistry.h" -#include "preferences.h" #include "conn-avoid-ref.h" #include "conditions.h" -#include "sp-filter-reference.h" #include "filter-chemistry.h" #include "sp-guide.h" #include "sp-title.h" @@ -53,13 +48,8 @@ #include "util/find-last-if.h" #include "util/reverse-list.h" -#include <2geom/rect.h> -#include <2geom/affine.h> -#include <2geom/transforms.h> -#include "xml/repr.h" #include "extract-uri.h" -#include "helper/geom.h" #include "live_effects/lpeobject.h" #include "live_effects/effect.h" -- cgit v1.2.3 From 812258dc01faa6b26534a2aa5d7536b4cb892c01 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Mon, 12 Sep 2016 12:28:31 +0200 Subject: Fixed out of range pointers Fixed bugs: - https://launchpad.net/bugs/1620253 (bzr r15114) --- src/sp-item.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 0ba74f9fd..e03b715c0 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -317,8 +317,11 @@ void SPItem::lowerOne() { auto next_lower = find_last_if(parent->children.begin(), parent->children.iterator_to(*this), &is_item); if (next_lower != parent->children.iterator_to(*this)) { - next_lower--; - Inkscape::XML::Node *ref = next_lower->getRepr(); + Inkscape::XML::Node *ref = nullptr; + if (next_lower != parent->children.begin()) { + next_lower--; + ref = next_lower->getRepr(); + } getRepr()->parent()->changeOrder(getRepr(), ref); } } @@ -326,8 +329,11 @@ void SPItem::lowerOne() { void SPItem::lowerToBottom() { auto bottom = std::find_if(parent->children.begin(), parent->children.iterator_to(*this), &is_item); if (bottom != parent->children.iterator_to(*this)) { - bottom--; - Inkscape::XML::Node *ref = bottom->getRepr() ; + Inkscape::XML::Node *ref = nullptr; + if (bottom != parent->children.begin()) { + bottom--; + ref = bottom->getRepr(); + } parent->getRepr()->changeOrder(getRepr(), ref); } } -- cgit v1.2.3 From f273f14eb1b54861f1b3a7eb622cb481ee33cec9 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 26 Sep 2016 13:26:47 +0200 Subject: Fix undo/redo for mesh gradients. (bzr r15135) --- src/sp-item.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index e03b715c0..d161562fd 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -59,6 +59,7 @@ #define noSP_ITEM_DEBUG_IDLE +//#define OBJECT_TRACE static SPItemView* sp_item_view_list_remove(SPItemView *list, SPItemView *view); @@ -691,6 +692,10 @@ void SPItem::update(SPCtx* ctx, guint flags) { void SPItem::modified(unsigned int /*flags*/) { +#ifdef OBJECT_TRACE + objectTrace( "SPItem::modified" ); + objectTrace( "SPItem::modified", false ); +#endif } Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { -- cgit v1.2.3 From 6162cf1a9f6953319e0e3d6b56354c5cb0f26352 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 3 Nov 2016 00:08:41 +0100 Subject: Add some unit tests for object-set cppification (bzr r15203) --- src/sp-item.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index f52784489..36a9c3c9d 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -868,6 +868,17 @@ Geom::OptRect SPItem::bounds(BBoxType type, Geom::Affine const &transform) const } } +Geom::OptRect SPItem::documentPreferredBounds() const +{ + if (Inkscape::Preferences::get()->getInt("/tools/bounding_box") == 0) { + return documentBounds(SPItem::VISUAL_BBOX); + } else { + return documentBounds(SPItem::GEOMETRIC_BBOX); + } +} + + + Geom::OptRect SPItem::documentGeometricBounds() const { return geometricBounds(i2doc_affine()); -- cgit v1.2.3 From b6200950a88ac9b1bb7eee4fb7f86b01e323dbcc Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 5 Jan 2017 00:08:02 +0100 Subject: antialiasing options on export (bzr r15391) --- src/sp-item.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 36a9c3c9d..05af12229 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -667,7 +667,7 @@ void SPItem::update(SPCtx* ctx, guint flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = display; v != NULL; v = v->next) { v->arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(style->opacity.value)); - v->arenaitem->setAntialiasing(style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES); + v->arenaitem->setAntialiasing(style->shape_rendering.computed == SP_CSS_SHAPE_RENDERING_CRISPEDGES ? 0 : 2); v->arenaitem->setIsolation( style->isolation.value ); v->arenaitem->setBlendMode( style->mix_blend_mode.value ); v->arenaitem->setVisible(!isHidden()); -- cgit v1.2.3 From 2a903d02506837d99d043d50477950a148c140ab Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 17 Jan 2017 11:33:02 +0100 Subject: Fix regression on selecting objects after locking layers Fixed bugs: - https://launchpad.net/bugs/1656141 (bzr r15419) --- src/sp-item.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 05af12229..5d02020c6 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -121,6 +121,7 @@ void SPItem::setLocked(bool locked) { setAttribute("sodipodi:insensitive", ( locked ? "1" : NULL )); updateRepr(); + document->_emitModified(); } bool SPItem::isHidden() const { -- cgit v1.2.3 From 349536d49558ec5841e799eb33a4cbbb3fa9722d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 5 Feb 2017 16:04:35 +0000 Subject: Fix C++11 errors and warnings with g++-7 Fixed bugs: - https://launchpad.net/bugs/1660992 (bzr r15477) --- src/sp-item.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 5d02020c6..e2f678957 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -17,6 +17,10 @@ #endif #include "sp-item.h" + +#include + +#include "bad-uri-exception.h" #include "svg/svg.h" #include "print.h" #include "display/drawing-item.h" @@ -25,10 +29,7 @@ #include "uri.h" #include "inkscape.h" #include "desktop.h" - - #include "style.h" -#include #include "sp-root.h" #include "sp-clippath.h" #include "sp-mask.h" -- cgit v1.2.3 From dc80e5d0bf82f005628881134b929aa4838308d5 Mon Sep 17 00:00:00 2001 From: chr Date: Tue, 23 May 2017 21:48:22 +0200 Subject: selection chemistry: implement z-stack order Bug #1395452 "raise and lower objects" used to stack objects above/below the next overlapping object, which makes it impossible to change the z-order of objects that don't overlap. Fixes also the object manager panel Conflicts: src/selection-chemistry.cpp src/selection-chemistry.h src/sp-item.cpp (bzr r15698.1.7) --- src/sp-item.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index e2f678957..368f8896c 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -306,15 +306,17 @@ void SPItem::raiseToTop() { } } -void SPItem::raiseOne() { +bool SPItem::raiseOne() { auto next_higher = std::find_if(++parent->children.iterator_to(*this), parent->children.end(), &is_item); if (next_higher != parent->children.end()) { Inkscape::XML::Node *ref = next_higher->getRepr(); getRepr()->parent()->changeOrder(getRepr(), ref); + return true; } + return false; } -void SPItem::lowerOne() { +bool SPItem::lowerOne() { using Inkscape::Algorithms::find_last_if; auto next_lower = find_last_if(parent->children.begin(), parent->children.iterator_to(*this), &is_item); @@ -325,7 +327,9 @@ void SPItem::lowerOne() { ref = next_lower->getRepr(); } getRepr()->parent()->changeOrder(getRepr(), ref); + return true; } + return false; } void SPItem::lowerToBottom() { -- cgit v1.2.3