src/addObjectDialog.cc

changeset 714
b4a990f59a5e
parent 662
2f1bd9112408
child 733
cc39df788660
equal deleted inserted replaced
713:46377d340c23 714:b4a990f59a5e
310 le_subfileName->setText (name); 310 le_subfileName->setText (name);
311 } 311 }
312 312
313 // ============================================================================= 313 // =============================================================================
314 // ============================================================================= 314 // =============================================================================
315 template<class T> static T* initObj (LDObject*& obj) 315 template<typename T>
316 static T* initObj (LDObject*& obj)
316 { 317 {
317 if (obj == null) 318 if (obj == null)
318 obj = new T; 319 obj = new T;
319 320
320 return static_cast<T*> (obj); 321 return static_cast<T*> (obj);
337 Matrix transform = g_identity; 338 Matrix transform = g_identity;
338 AddObjectDialog dlg (type, obj); 339 AddObjectDialog dlg (type, obj);
339 340
340 assert (obj == null || obj->type() == type); 341 assert (obj == null || obj->type() == type);
341 342
342 if (dlg.exec() == false) 343 if (dlg.exec() == QDialog::Rejected)
343 return; 344 return;
344 345
345 if (type == LDObject::ESubfile) 346 if (type == LDObject::ESubfile)
346 { 347 {
347 QStringList matrixstrvals = dlg.le_matrix->text().split (" ", QString::SkipEmptyParts); 348 QStringList matrixstrvals = dlg.le_matrix->text().split (" ", QString::SkipEmptyParts);
370 case LDObject::ELine: 371 case LDObject::ELine:
371 case LDObject::ETriangle: 372 case LDObject::ETriangle:
372 case LDObject::EQuad: 373 case LDObject::EQuad:
373 case LDObject::ECondLine: 374 case LDObject::ECondLine:
374 { 375 {
375 if (!obj) 376 if (not obj)
376 obj = LDObject::getDefault (type); 377 obj = LDObject::getDefault (type);
377 378
378 for (int i = 0; i < obj->vertices(); ++i) 379 for (int i = 0; i < obj->vertices(); ++i)
379 { 380 {
380 Vertex v; 381 Vertex v;
408 if (name.length() == 0) 409 if (name.length() == 0)
409 return; // no subfile filename 410 return; // no subfile filename
410 411
411 LDDocument* file = getDocument (name); 412 LDDocument* file = getDocument (name);
412 413
413 if (!file) 414 if (not file)
414 { 415 {
415 critical (format ("Couldn't open `%1': %2", name, strerror (errno))); 416 critical (format ("Couldn't open `%1': %2", name, strerror (errno)));
416 return; 417 return;
417 } 418 }
418 419

mercurial