src/toolsets/basictoolset.cpp

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

mercurial