diff -r aee618d087ff -r 389516787a4c src/toolsets/basictoolset.cpp --- a/src/toolsets/basictoolset.cpp Sat Mar 17 23:59:15 2018 +0200 +++ b/src/toolsets/basictoolset.cpp Sun Mar 18 12:00:39 2018 +0200 @@ -32,6 +32,7 @@ #include "../ldobjectiterator.h" #include "../mainwindow.h" #include "../dialogs/colorselector.h" +#include "../dialogs/subfilereferenceeditor.h" #include "../grid.h" #include "../parser.h" #include "../widgets/vertexobjecteditor.h" @@ -292,36 +293,44 @@ } template -void createBasicObject(MainWindow* window) +static T* createObject(MainWindow* window) { - LDObject* object = window->currentDocument()->emplaceAt(window->suggestInsertPoint()); + return window->currentDocument()->emplaceAt(window->suggestInsertPoint()); +} + +template +static void createVertexObject(MainWindow* window) +{ + LDObject* object = createObject(window); VertexObjectEditor editor {object}; editor.exec(); } void BasicToolset::newSubfile() { - // TODO: + LDSubfileReference* reference = createObject(this->m_window); + SubfileReferenceEditor editor {reference, this->m_window}; + editor.exec(); } void BasicToolset::newLine() { - createBasicObject(this->m_window); + createVertexObject(this->m_window); } void BasicToolset::newTriangle() { - createBasicObject(this->m_window); + createVertexObject(this->m_window); } void BasicToolset::newQuadrilateral() { - createBasicObject(this->m_window); + createVertexObject(this->m_window); } void BasicToolset::newConditionalLine() { - createBasicObject(this->m_window); + createVertexObject(this->m_window); } void BasicToolset::newComment()