Sat, 03 Mar 2018 16:56:49 +0200
moved LDObject::next to the algorithm toolset
--- a/src/linetypes/modelobject.cpp Sat Mar 03 16:53:56 2018 +0200 +++ b/src/linetypes/modelobject.cpp Sat Mar 03 16:56:49 2018 +0200 @@ -271,15 +271,6 @@ // ============================================================================= // -// Object after this in the current file -// -LDObject* LDObject::next() -{ - return model()->getObject(model()->indexOf(this).row() + 1); -} - -// ============================================================================= -// // Moves this object using the given vertex as a movement List // void LDObject::move (Vertex vect)
--- a/src/linetypes/modelobject.h Sat Mar 03 16:53:56 2018 +0200 +++ b/src/linetypes/modelobject.h Sat Mar 03 16:56:49 2018 +0200 @@ -73,7 +73,6 @@ virtual bool isScemantic() const; // Does this object have meaning in the part model? bool isSelected() const; void move (Vertex vect); - LDObject* next(); virtual int numVertices() const; virtual int numPolygonVertices() const; virtual QString objectListText() const;
--- a/src/toolsets/algorithmtoolset.cpp Sat Mar 03 16:53:56 2018 +0200 +++ b/src/toolsets/algorithmtoolset.cpp Sat Mar 03 16:56:49 2018 +0200 @@ -306,6 +306,16 @@ return false; } +LDObject* AlgorithmToolset::next(LDObject* object) +{ + QModelIndex index = currentDocument()->indexOf(object); + + if (index.isValid()) + return currentDocument()->getObject(index.row() + 1); + else + return nullptr; +} + void AlgorithmToolset::autocolor() { LDColor color; @@ -351,8 +361,8 @@ // Find a spot to place the new comment for (obj = currentDocument()->getObject (0); - obj and obj->next() and not obj->next()->isScemantic(); - obj = obj->next()) + obj and next(obj) and not next(obj)->isScemantic(); + obj = next(obj)) { LDComment* comment = dynamic_cast<LDComment*> (obj); @@ -375,7 +385,7 @@ // If we're adding a history line right before a scemantic object, pad it // an empty line - if (obj and obj->next() and obj->next()->isScemantic()) + if (obj and next(obj) and next(obj)->isScemantic()) currentDocument()->emplaceAt<LDEmpty>(idx); }