src/gui.cc

changeset 560
39085791128f
parent 557
04e140bdeb0b
child 561
1d90296ad3fc
equal deleted inserted replaced
559:5a31f6c14451 560:39085791128f
264 264
265 QList<LDObject*> selCopy = selection(); 265 QList<LDObject*> selCopy = selection();
266 266
267 // Delete the objects that were being selected 267 // Delete the objects that were being selected
268 for (LDObject* obj : selCopy) 268 for (LDObject* obj : selCopy)
269 delete obj; 269 obj->deleteSelf();
270 270
271 refresh(); 271 refresh();
272 return selCopy.size(); 272 return selCopy.size();
273 } 273 }
274 274
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;
906 { 905 {
907 #if 0 906 #if 0
908 ui->objectList->clear(); 907 ui->objectList->clear();
909 LDDocument* f = getCurrentDocument(); 908 LDDocument* f = getCurrentDocument();
910 909
911 for (LDObject * obj : *f) 910 for (LDObject* obj : *f)
912 ui->objectList->addItem (obj->qObjListEntry); 911 ui->objectList->addItem (obj->qObjListEntry);
913 912
914 #endif 913 #endif
915 914
916 buildObjList(); 915 buildObjList();

mercurial