src/toolsets/basictoolset.cpp

changeset 1297
389516787a4c
parent 1296
aee618d087ff
child 1298
dbc8bb2a4d84
equal deleted inserted replaced
1296:aee618d087ff 1297:389516787a4c
30 #include "../linetypes/edgeline.h" 30 #include "../linetypes/edgeline.h"
31 #include "../linetypes/conditionaledge.h" 31 #include "../linetypes/conditionaledge.h"
32 #include "../ldobjectiterator.h" 32 #include "../ldobjectiterator.h"
33 #include "../mainwindow.h" 33 #include "../mainwindow.h"
34 #include "../dialogs/colorselector.h" 34 #include "../dialogs/colorselector.h"
35 #include "../dialogs/subfilereferenceeditor.h"
35 #include "../grid.h" 36 #include "../grid.h"
36 #include "../parser.h" 37 #include "../parser.h"
37 #include "../widgets/vertexobjecteditor.h" 38 #include "../widgets/vertexobjecteditor.h"
38 #include "basictoolset.h" 39 #include "basictoolset.h"
39 40
290 } 291 }
291 } 292 }
292 } 293 }
293 294
294 template<typename T> 295 template<typename T>
295 void createBasicObject(MainWindow* window) 296 static T* createObject(MainWindow* window)
296 { 297 {
297 LDObject* object = window->currentDocument()->emplaceAt<T>(window->suggestInsertPoint()); 298 return window->currentDocument()->emplaceAt<T>(window->suggestInsertPoint());
299 }
300
301 template<typename T>
302 static void createVertexObject(MainWindow* window)
303 {
304 LDObject* object = createObject<T>(window);
298 VertexObjectEditor editor {object}; 305 VertexObjectEditor editor {object};
299 editor.exec(); 306 editor.exec();
300 } 307 }
301 308
302 void BasicToolset::newSubfile() 309 void BasicToolset::newSubfile()
303 { 310 {
304 // TODO: 311 LDSubfileReference* reference = createObject<LDSubfileReference>(this->m_window);
312 SubfileReferenceEditor editor {reference, this->m_window};
313 editor.exec();
305 } 314 }
306 315
307 void BasicToolset::newLine() 316 void BasicToolset::newLine()
308 { 317 {
309 createBasicObject<LDEdgeLine>(this->m_window); 318 createVertexObject<LDEdgeLine>(this->m_window);
310 } 319 }
311 320
312 void BasicToolset::newTriangle() 321 void BasicToolset::newTriangle()
313 { 322 {
314 createBasicObject<LDTriangle>(this->m_window); 323 createVertexObject<LDTriangle>(this->m_window);
315 } 324 }
316 325
317 void BasicToolset::newQuadrilateral() 326 void BasicToolset::newQuadrilateral()
318 { 327 {
319 createBasicObject<LDQuadrilateral>(this->m_window); 328 createVertexObject<LDQuadrilateral>(this->m_window);
320 } 329 }
321 330
322 void BasicToolset::newConditionalLine() 331 void BasicToolset::newConditionalLine()
323 { 332 {
324 createBasicObject<LDConditionalEdge>(this->m_window); 333 createVertexObject<LDConditionalEdge>(this->m_window);
325 } 334 }
326 335
327 void BasicToolset::newComment() 336 void BasicToolset::newComment()
328 { 337 {
329 // TODO: 338 // TODO:

mercurial