539 m_objList->clear (); |
539 m_objList->clear (); |
540 |
540 |
541 for (LDObject* obj : g_curfile->m_objs) { |
541 for (LDObject* obj : g_curfile->m_objs) { |
542 str zText; |
542 str zText; |
543 switch (obj->getType ()) { |
543 switch (obj->getType ()) { |
544 case OBJ_Comment: |
544 case LDObject::Comment: |
545 zText = static_cast<LDComment*> (obj)->text.chars(); |
545 zText = static_cast<LDComment*> (obj)->text.chars(); |
546 |
546 |
547 // Remove leading whitespace |
547 // Remove leading whitespace |
548 while (~zText && zText[0] == ' ') |
548 while (~zText && zText[0] == ' ') |
549 zText -= -1; |
549 zText -= -1; |
550 break; |
550 break; |
551 |
551 |
552 case OBJ_Empty: |
552 case LDObject::Empty: |
553 break; // leave it empty |
553 break; // leave it empty |
554 |
554 |
555 case OBJ_Line: |
555 case LDObject::Line: |
556 { |
556 { |
557 LDLine* line = static_cast<LDLine*> (obj); |
557 LDLine* line = static_cast<LDLine*> (obj); |
558 zText.format ("%s, %s", |
558 zText.format ("%s, %s", |
559 line->vaCoords[0].stringRep (true).chars(), |
559 line->vaCoords[0].stringRep (true).chars(), |
560 line->vaCoords[1].stringRep (true).chars()); |
560 line->vaCoords[1].stringRep (true).chars()); |
561 } |
561 } |
562 break; |
562 break; |
563 |
563 |
564 case OBJ_Triangle: |
564 case LDObject::Triangle: |
565 { |
565 { |
566 LDTriangle* triangle = static_cast<LDTriangle*> (obj); |
566 LDTriangle* triangle = static_cast<LDTriangle*> (obj); |
567 zText.format ("%s, %s, %s", |
567 zText.format ("%s, %s, %s", |
568 triangle->vaCoords[0].stringRep (true).chars(), |
568 triangle->vaCoords[0].stringRep (true).chars(), |
569 triangle->vaCoords[1].stringRep (true).chars(), |
569 triangle->vaCoords[1].stringRep (true).chars(), |
570 triangle->vaCoords[2].stringRep (true).chars()); |
570 triangle->vaCoords[2].stringRep (true).chars()); |
571 } |
571 } |
572 break; |
572 break; |
573 |
573 |
574 case OBJ_Quad: |
574 case LDObject::Quad: |
575 { |
575 { |
576 LDQuad* quad = static_cast<LDQuad*> (obj); |
576 LDQuad* quad = static_cast<LDQuad*> (obj); |
577 zText.format ("%s, %s, %s, %s", |
577 zText.format ("%s, %s, %s, %s", |
578 quad->vaCoords[0].stringRep (true).chars(), |
578 quad->vaCoords[0].stringRep (true).chars(), |
579 quad->vaCoords[1].stringRep (true).chars(), |
579 quad->vaCoords[1].stringRep (true).chars(), |
580 quad->vaCoords[2].stringRep (true).chars(), |
580 quad->vaCoords[2].stringRep (true).chars(), |
581 quad->vaCoords[3].stringRep (true).chars()); |
581 quad->vaCoords[3].stringRep (true).chars()); |
582 } |
582 } |
583 break; |
583 break; |
584 |
584 |
585 case OBJ_CondLine: |
585 case LDObject::CondLine: |
586 { |
586 { |
587 LDCondLine* line = static_cast<LDCondLine*> (obj); |
587 LDCondLine* line = static_cast<LDCondLine*> (obj); |
588 zText.format ("%s, %s, %s, %s", |
588 zText.format ("%s, %s, %s, %s", |
589 line->vaCoords[0].stringRep (true).chars(), |
589 line->vaCoords[0].stringRep (true).chars(), |
590 line->vaCoords[1].stringRep (true).chars(), |
590 line->vaCoords[1].stringRep (true).chars(), |
591 line->vaCoords[2].stringRep (true).chars(), |
591 line->vaCoords[2].stringRep (true).chars(), |
592 line->vaCoords[3].stringRep (true).chars()); |
592 line->vaCoords[3].stringRep (true).chars()); |
593 } |
593 } |
594 break; |
594 break; |
595 |
595 |
596 case OBJ_Gibberish: |
596 case LDObject::Gibberish: |
597 zText.format ("ERROR: %s", |
597 zText.format ("ERROR: %s", |
598 static_cast<LDGibberish*> (obj)->zContents.chars()); |
598 static_cast<LDGibberish*> (obj)->zContents.chars()); |
599 break; |
599 break; |
600 |
600 |
601 case OBJ_Vertex: |
601 case LDObject::Vertex: |
602 zText.format ("%s", static_cast<LDVertex*> (obj)->vPosition.stringRep (true).chars()); |
602 zText.format ("%s", static_cast<LDVertex*> (obj)->vPosition.stringRep (true).chars()); |
603 break; |
603 break; |
604 |
604 |
605 case OBJ_Subfile: |
605 case LDObject::Subfile: |
606 { |
606 { |
607 LDSubfile* ref = static_cast<LDSubfile*> (obj); |
607 LDSubfile* ref = static_cast<LDSubfile*> (obj); |
608 |
608 |
609 zText.format ("%s %s, (", |
609 zText.format ("%s %s, (", |
610 ref->zFileName.chars(), ref->vPosition.stringRep (true).chars()); |
610 ref->zFileName.chars(), ref->vPosition.stringRep (true).chars()); |
834 } |
834 } |
835 |
835 |
836 // ============================================================================= |
836 // ============================================================================= |
837 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
837 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
838 // ============================================================================= |
838 // ============================================================================= |
839 LDObjectType_e ForgeWindow::uniformSelectedType () { |
839 LDObject::Type ForgeWindow::uniformSelectedType () { |
840 LDObjectType_e eResult = OBJ_Unidentified; |
840 LDObject::Type eResult = LDObject::Unidentified; |
841 |
841 |
842 for (LDObject* obj : m_sel) { |
842 for (LDObject* obj : m_sel) { |
843 if (eResult != OBJ_Unidentified && obj->dColor != eResult) |
843 if (eResult != LDObject::Unidentified && obj->dColor != eResult) |
844 return OBJ_Unidentified; |
844 return LDObject::Unidentified; |
845 |
845 |
846 if (eResult == OBJ_Unidentified) |
846 if (eResult == LDObject::Unidentified) |
847 eResult = obj->getType (); |
847 eResult = obj->getType (); |
848 } |
848 } |
849 |
849 |
850 return eResult; |
850 return eResult; |
851 } |
851 } |