diff options
| author | Adrian Boguszewski <adrbogus1@student.pg.gda.pl> | 2016-07-14 10:56:49 +0000 |
|---|---|---|
| committer | Adrian Boguszewski <adrbogus1@student.pg.gda.pl> | 2016-07-14 10:56:49 +0000 |
| commit | 9e210a6d1333c3366681547e3e81593ef69ff73e (patch) | |
| tree | 4320e35b2e347c4b2552b963f7ed7f9a6c8441cc /src/selection-chemistry.cpp | |
| parent | Second part of new SPObject children list (diff) | |
| download | inkscape-9e210a6d1333c3366681547e3e81593ef69ff73e.tar.gz inkscape-9e210a6d1333c3366681547e3e81593ef69ff73e.zip | |
Last part of new SPObject children list
(bzr r14954.1.20)
Diffstat (limited to 'src/selection-chemistry.cpp')
| -rw-r--r-- | src/selection-chemistry.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 55f4118b0..28bcadef5 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1010,7 +1010,7 @@ sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop) for (std::vector<SPItem*>::const_iterator item=rev.begin();item!=rev.end();++item) { SPObject *child = *item; // for each selected object, find the next sibling - for (SPObject *newref = child->next; newref; newref = newref->next) { + for (SPObject *newref = child->getNext(); newref; newref = newref->getNext()) { // if the sibling is an item AND overlaps our selection, SPItem *newItem = dynamic_cast<SPItem *>(newref); if (newItem) { @@ -1138,15 +1138,16 @@ void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *des for (std::vector<Inkscape::XML::Node*>::const_reverse_iterator l=rl.rbegin();l!=rl.rend();++l) { gint minpos; - SPObject *pp, *pc; + SPObject *pp; Inkscape::XML::Node *repr = (*l); pp = document->getObjectByRepr(repr->parent()); minpos = 0; g_assert(dynamic_cast<SPGroup *>(pp)); - pc = pp->firstChild(); - while (!dynamic_cast<SPItem *>(pc)) { + for (auto& pc: pp->_children) { + if(dynamic_cast<SPItem *>(&pc)) { + break; + } minpos += 1; - pc = pc->next; } repr->setPosition(minpos); } @@ -1197,8 +1198,8 @@ take_style_from_item(SPObject *object) if (css == NULL) return NULL; - if ((dynamic_cast<SPGroup *>(object) && object->children) || - (dynamic_cast<SPText *>(object) && object->children && object->children->next == NULL)) { + if ((dynamic_cast<SPGroup *>(object) && object->firstChild()) || + (dynamic_cast<SPText *>(object) && object->firstChild() && object->firstChild()->getNext() == NULL)) { // if this is a text with exactly one tspan child, merge the style of that tspan as well // If this is a group, merge the style of its topmost (last) child with style auto list = object->_children | boost::adaptors::reversed; @@ -2330,10 +2331,10 @@ typedef struct ListReverse { typedef GSList *Iterator; static Iterator children(SPObject *o) { - return make_list(o->firstChild(), NULL); + return make_list(o, NULL); } static Iterator siblings_after(SPObject *o) { - return make_list(o->parent->firstChild(), o); + return make_list(o->parent, o); } static void dispose(Iterator i) { g_slist_free(i); @@ -2347,13 +2348,12 @@ typedef struct ListReverse { private: static GSList *make_list(SPObject *object, SPObject *limit) { GSList *list = NULL; - while ( object != limit ) { - if (!object) { // TODO check if this happens in practice - g_warning("Unexpected list overrun"); + for (auto &child: object->_children) { + if (&child == limit) { break; } - list = g_slist_prepend(list, object); - object = object->getNext(); + list = g_slist_prepend(list, &child); + } return list; } |
