gui.cpp

changeset 73
d20867ac03cc
parent 72
5755c02d89f0
child 76
42284126072a
equal deleted inserted replaced
72:5755c02d89f0 73:d20867ac03cc
443 443
444 for (LDObject* obj : objs) { 444 for (LDObject* obj : objs) {
445 if (obj->getType() != OBJ_Quad) 445 if (obj->getType() != OBJ_Quad)
446 continue; 446 continue;
447 447
448 static_cast<LDQuad*> (obj)->splitToTriangles (); 448 // Find the index of this quad
449 long lIndex = obj->getIndex (g_CurrentFile);
450
451 if (lIndex == -1) {
452 // couldn't find it?
453 logf (LOG_Error, "Couldn't find quad %p in "
454 "current object list!!\n", this);
455 return;
456 }
457
458 std::vector<LDTriangle*> triangles = static_cast<LDQuad*> (obj)->splitToTriangles ();
459
460 // Replace the quad with the first triangle and add the second triangle
461 // after the first one.
462 g_CurrentFile->objects[lIndex] = triangles[0];
463 g_CurrentFile->objects.insert (g_CurrentFile->objects.begin() + lIndex + 1, triangles[1]);
464
465 // Delete this quad now, it has been split.
466 delete this;
449 } 467 }
450 468
451 refresh (); 469 refresh ();
452 } 470 }
453 471
642 660
643 zText += ')'; 661 zText += ')';
644 } 662 }
645 break; 663 break;
646 664
665 case OBJ_BFC:
666 {
667 LDBFC* bfc = static_cast<LDBFC*> (obj);
668 zText = LDBFC::saStatements[bfc->dStatement];
669 }
670 break;
671
647 default: 672 default:
648 zText = g_saObjTypeNames[obj->getType ()]; 673 zText = g_saObjTypeNames[obj->getType ()];
649 break; 674 break;
650 } 675 }
651 676
653 QStringList (zText.chars()), 0); 678 QStringList (zText.chars()), 0);
654 item->setIcon (0, QIcon (str::mkfmt ("icons/%s.png", g_saObjTypeIcons[obj->getType ()]).chars())); 679 item->setIcon (0, QIcon (str::mkfmt ("icons/%s.png", g_saObjTypeIcons[obj->getType ()]).chars()));
655 680
656 // Color gibberish red 681 // Color gibberish red
657 if (obj->getType() == OBJ_Gibberish) { 682 if (obj->getType() == OBJ_Gibberish) {
658 item->setBackgroundColor (0, "#AA0000"); 683 item->setBackground (0, QColor ("#AA0000"));
659 item->setForeground (0, QColor ("#FFAA00")); 684 item->setForeground (0, QColor ("#FFAA00"));
660 } else if (lv_colorize && 685 } else if (lv_colorize &&
661 obj->dColor != -1 && 686 obj->dColor != -1 &&
662 obj->dColor != dMainColor && 687 obj->dColor != dMainColor &&
663 obj->dColor != dEdgeColor) 688 obj->dColor != dEdgeColor)

mercurial