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 |
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) |