# HG changeset patch # User Santeri Piippo # Date 1515681982 -7200 # Node ID 468a32ae810048c3b47c1edb6e0dd3134dd2318d # Parent ff8561fc088f11fc32372fbf42ea2425e9cefd6b add operators to LDDocument diff -r ff8561fc088f -r 468a32ae8100 src/editmodes/magicWandMode.cpp --- a/src/editmodes/magicWandMode.cpp Thu Jan 11 15:41:58 2018 +0200 +++ b/src/editmodes/magicWandMode.cpp Thu Jan 11 16:46:22 2018 +0200 @@ -61,9 +61,15 @@ // Boundary found. If it's an edgeline, add it to the boundaries list, if a // conditional line, select it. if (candidate->type() == OBJ_CondLine) + { m_selection << candidate; + } else - boundaries.append({candidate->vertex(0), candidate->vertex(1)}); + { + boundaries.append(std::make_pair( + candidate->vertex(0), + candidate->vertex(1))); + } break; } diff -r ff8561fc088f -r 468a32ae8100 src/ldDocument.cpp --- a/src/ldDocument.cpp Thu Jan 11 15:41:58 2018 +0200 +++ b/src/ldDocument.cpp Thu Jan 11 16:46:22 2018 +0200 @@ -902,3 +902,11 @@ { m_needVertexMerge = true; } + +LDObject* LDDocument::operator[](int i) const +{ + if (i >= 0 and i < m_objects.size()) + return m_objects[i]; + else + throw std::out_of_range {"bad index"}; +} diff -r ff8561fc088f -r 468a32ae8100 src/ldDocument.h --- a/src/ldDocument.h Thu Jan 11 15:41:58 2018 +0200 +++ b/src/ldDocument.h Thu Jan 11 16:46:22 2018 +0200 @@ -100,6 +100,9 @@ static QString shortenName(QString a); // Turns a full path into a relative path + void operator=(const LDDocument&) = delete; + LDObject* operator[](int i) const; + signals: void closed();