gui.cpp

changeset 168
96691a009dff
parent 167
df78c894ae24
child 169
f562323760a2
equal deleted inserted replaced
167:df78c894ae24 168:96691a009dff
459 // Append our current file if we have one 459 // Append our current file if we have one
460 if (g_curfile) { 460 if (g_curfile) {
461 title += fmt (": %s", basename (g_curfile->m_filename.chars())); 461 title += fmt (": %s", basename (g_curfile->m_filename.chars()));
462 462
463 if (g_curfile->m_objs.size() > 0 && 463 if (g_curfile->m_objs.size() > 0 &&
464 g_curfile->m_objs[0]->getType() == OBJ_Comment) 464 g_curfile->m_objs[0]->getType() == LDObject::Comment)
465 { 465 {
466 // Append title 466 // Append title
467 LDComment* comm = static_cast<LDComment*> (g_curfile->m_objs[0]); 467 LDComment* comm = static_cast<LDComment*> (g_curfile->m_objs[0]);
468 title += fmt (": %s", comm->text.chars()); 468 title += fmt (": %s", comm->text.chars());
469 } 469 }
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());
616 616
617 zText += ')'; 617 zText += ')';
618 } 618 }
619 break; 619 break;
620 620
621 case OBJ_BFC: 621 case LDObject::BFC:
622 { 622 {
623 LDBFC* bfc = static_cast<LDBFC*> (obj); 623 LDBFC* bfc = static_cast<LDBFC*> (obj);
624 zText = LDBFC::statements[bfc->type]; 624 zText = LDBFC::statements[bfc->type];
625 } 625 }
626 break; 626 break;
627 627
628 case OBJ_Radial: 628 case LDObject::Radial:
629 { 629 {
630 LDRadial* pRad = static_cast<LDRadial*> (obj); 630 LDRadial* pRad = static_cast<LDRadial*> (obj);
631 zText.format ("%d / %d %s", pRad->dSegments, pRad->dDivisions, pRad->radialTypeName()); 631 zText.format ("%d / %d %s", pRad->dSegments, pRad->dDivisions, pRad->radialTypeName());
632 632
633 if (pRad->eRadialType == LDRadial::Ring || pRad->eRadialType == LDRadial::Cone) 633 if (pRad->eRadialType == LDRadial::Ring || pRad->eRadialType == LDRadial::Cone)
644 644
645 QListWidgetItem* item = new QListWidgetItem (zText.chars()); 645 QListWidgetItem* item = new QListWidgetItem (zText.chars());
646 item->setIcon (getIcon (g_saObjTypeIcons[obj->getType ()])); 646 item->setIcon (getIcon (g_saObjTypeIcons[obj->getType ()]));
647 647
648 // Color gibberish orange on red so it stands out. 648 // Color gibberish orange on red so it stands out.
649 if (obj->getType() == OBJ_Gibberish) { 649 if (obj->getType() == LDObject::Gibberish) {
650 item->setBackground (QColor ("#AA0000")); 650 item->setBackground (QColor ("#AA0000"));
651 item->setForeground (QColor ("#FFAA00")); 651 item->setForeground (QColor ("#FFAA00"));
652 } else if (lv_colorize && obj->isColored () && 652 } else if (lv_colorize && obj->isColored () &&
653 obj->dColor != maincolor && obj->dColor != edgecolor) 653 obj->dColor != maincolor && obj->dColor != edgecolor)
654 { 654 {
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 }

mercurial