538 // ============================================================================= |
538 // ============================================================================= |
539 // ----------------------------------------------------------------------------- |
539 // ----------------------------------------------------------------------------- |
540 LDObject::Type ForgeWindow::getUniformSelectedType() |
540 LDObject::Type ForgeWindow::getUniformSelectedType() |
541 { LDObject::Type result = LDObject::Unidentified; |
541 { LDObject::Type result = LDObject::Unidentified; |
542 |
542 |
543 for (LDObject * obj : selection()) |
543 for (LDObject* obj : selection()) |
544 { if (result != LDObject::Unidentified && obj->getColor() != result) |
544 { if (result != LDObject::Unidentified && obj->getColor() != result) |
545 return LDObject::Unidentified; |
545 return LDObject::Unidentified; |
546 |
546 |
547 if (result == LDObject::Unidentified) |
547 if (result == LDObject::Unidentified) |
548 result = obj->getType(); |
548 result = obj->getType(); |
604 |
604 |
605 contextMenu->exec (pos); |
605 contextMenu->exec (pos); |
606 } |
606 } |
607 |
607 |
608 // ============================================================================= |
608 // ============================================================================= |
|
609 // TODO: what the heh? |
609 // ----------------------------------------------------------------------------- |
610 // ----------------------------------------------------------------------------- |
610 void ForgeWindow::deleteObjects (QList<LDObject*> objs) |
611 void ForgeWindow::deleteObjects (QList<LDObject*> objs) |
611 { for (LDObject * obj : objs) |
612 { for (LDObject* obj : objs) |
612 { getCurrentDocument()->forgetObject (obj); |
613 obj->deleteSelf(); |
613 delete obj; |
|
614 } |
|
615 } |
614 } |
616 |
615 |
617 // ============================================================================= |
616 // ============================================================================= |
618 // ----------------------------------------------------------------------------- |
617 // ----------------------------------------------------------------------------- |
619 void ForgeWindow::deleteByColor (const int colnum) |
618 void ForgeWindow::deleteByColor (const int colnum) |
783 |
782 |
784 // ============================================================================= |
783 // ============================================================================= |
785 void makeColorComboBox (QComboBox* box) |
784 void makeColorComboBox (QComboBox* box) |
786 { std::map<int, int> counts; |
785 { std::map<int, int> counts; |
787 |
786 |
788 for (LDObject * obj : getCurrentDocument()->getObjects()) |
787 for (LDObject* obj : getCurrentDocument()->getObjects()) |
789 { if (!obj->isColored()) |
788 { if (!obj->isColored()) |
790 continue; |
789 continue; |
791 |
790 |
792 if (counts.find (obj->getColor()) == counts.end()) |
791 if (counts.find (obj->getColor()) == counts.end()) |
793 counts[obj->getColor()] = 1; |
792 counts[obj->getColor()] = 1; |