297 int ForgeWindow::deleteSelection() |
297 int ForgeWindow::deleteSelection() |
298 { |
298 { |
299 if (selection().isEmpty()) |
299 if (selection().isEmpty()) |
300 return 0; |
300 return 0; |
301 |
301 |
302 QList<LDObject*> selCopy = selection(); |
302 LDObjectList selCopy = selection(); |
303 |
303 |
304 // Delete the objects that were being selected |
304 // Delete the objects that were being selected |
305 for (LDObject* obj : selCopy) |
305 for (LDObject* obj : selCopy) |
306 obj->deleteSelf(); |
306 obj->deleteSelf(); |
307 |
307 |
458 // called during GL picking, in which case the GL renderer takes care |
458 // called during GL picking, in which case the GL renderer takes care |
459 // of the selection. |
459 // of the selection. |
460 if (m_renderer->isPicking()) |
460 if (m_renderer->isPicking()) |
461 return; |
461 return; |
462 |
462 |
463 QList<LDObject*> priorSelection = selection(); |
463 LDObjectList priorSelection = selection(); |
464 |
464 |
465 // Get the objects from the object list selection |
465 // Get the objects from the object list selection |
466 getCurrentDocument()->clearSelection(); |
466 getCurrentDocument()->clearSelection(); |
467 const QList<QListWidgetItem*> items = ui->objectList->selectedItems(); |
467 const QList<QListWidgetItem*> items = ui->objectList->selectedItems(); |
468 |
468 |
477 } |
477 } |
478 } |
478 } |
479 } |
479 } |
480 |
480 |
481 // Update the GL renderer |
481 // Update the GL renderer |
482 QList<LDObject*> compound = priorSelection + selection(); |
482 LDObjectList compound = priorSelection + selection(); |
483 removeDuplicates (compound); |
483 removeDuplicates (compound); |
484 |
484 |
485 for (LDObject* obj : compound) |
485 for (LDObject* obj : compound) |
486 m_renderer->compileObject (obj); |
486 m_renderer->compileObject (obj); |
487 |
487 |
687 } |
687 } |
688 |
688 |
689 // ============================================================================= |
689 // ============================================================================= |
690 // TODO: what the heh? |
690 // TODO: what the heh? |
691 // ----------------------------------------------------------------------------- |
691 // ----------------------------------------------------------------------------- |
692 void ForgeWindow::deleteObjects (QList<LDObject*> objs) |
692 void ForgeWindow::deleteObjects (LDObjectList objs) |
693 { |
693 { |
694 for (LDObject* obj : objs) |
694 for (LDObject* obj : objs) |
695 obj->deleteSelf(); |
695 obj->deleteSelf(); |
696 } |
696 } |
697 |
697 |
698 // ============================================================================= |
698 // ============================================================================= |
699 // ----------------------------------------------------------------------------- |
699 // ----------------------------------------------------------------------------- |
700 void ForgeWindow::deleteByColor (const int colnum) |
700 void ForgeWindow::deleteByColor (const int colnum) |
701 { |
701 { |
702 QList<LDObject*> objs; |
702 LDObjectList objs; |
703 |
703 |
704 for (LDObject* obj : getCurrentDocument()->getObjects()) |
704 for (LDObject* obj : getCurrentDocument()->getObjects()) |
705 { |
705 { |
706 if (!obj->isColored() || obj->getColor() != colnum) |
706 if (!obj->isColored() || obj->getColor() != colnum) |
707 continue; |
707 continue; |