| 304 |
304 |
| 305 int ln = obj->lineNumber(); |
305 int ln = obj->lineNumber(); |
| 306 |
306 |
| 307 for (int i = 0; i < obj->numVertices(); ++i) |
307 for (int i = 0; i < obj->numVertices(); ++i) |
| 308 { |
308 { |
| 309 QSharedPointer<LDVertex> vert (LDSpawn<LDVertex>()); |
309 LDVertex* vertex = new LDVertex(); |
| 310 vert->pos = obj->vertex (i); |
310 vertex->pos = obj->vertex (i); |
| 311 vert->setColor (obj->color()); |
311 vertex->setColor (obj->color()); |
| 312 CurrentDocument()->insertObj (++ln, vert); |
312 CurrentDocument()->insertObj (++ln, vertex); |
| 313 ++num; |
313 ++num; |
| 314 } |
314 } |
| 315 } |
315 } |
| 316 |
316 |
| 317 print (tr ("Added %1 vertices"), num); |
317 print (tr ("Added %1 vertices"), num); |
| 622 |
622 |
| 623 // ============================================================================= |
623 // ============================================================================= |
| 624 // |
624 // |
| 625 void MainWindow::slot_actionAutocolor() |
625 void MainWindow::slot_actionAutocolor() |
| 626 { |
626 { |
| 627 int colnum = 0; |
|
| 628 LDColor color; |
627 LDColor color; |
| 629 |
628 |
| 630 for (colnum = 0; |
629 for (color = 0; color.isLDConfigColor(); ++color) |
| 631 colnum < CountLDConfigColors() and |
630 { |
| 632 ((color = LDColor::fromIndex (colnum)) == null or |
631 if (color.isValid() and not IsColorUsed (color)) |
| 633 IsColorUsed (color)); |
632 break; |
| 634 colnum++) {} |
633 } |
| 635 |
634 |
| 636 if (colnum >= CountLDConfigColors()) |
635 if (not color.isLDConfigColor()) |
| 637 { |
636 { |
| 638 print (tr ("Cannot auto-color: all colors are in use!")); |
637 print (tr ("Cannot auto-color: all colors are in use!")); |
| 639 return; |
638 return; |
| 640 } |
639 } |
| 641 |
640 |
| 690 |
689 |
| 691 prevIsHistory = ishistory; |
690 prevIsHistory = ishistory; |
| 692 } |
691 } |
| 693 |
692 |
| 694 int idx = obj ? obj->lineNumber() : 0; |
693 int idx = obj ? obj->lineNumber() : 0; |
| 695 CurrentDocument()->insertObj (idx++, comm); |
694 CurrentDocument()->insertObj (idx++, comment); |
| 696 |
695 |
| 697 // If we're adding a history line right before a scemantic object, pad it |
696 // If we're adding a history line right before a scemantic object, pad it |
| 698 // an empty line |
697 // an empty line |
| 699 if (obj and obj->next() and obj->next()->isScemantic()) |
698 if (obj and obj->next() and obj->next()->isScemantic()) |
| 700 CurrentDocument()->insertObj (idx, new LDEmpty); |
699 CurrentDocument()->insertObj (idx, new LDEmpty); |