630 } |
630 } |
631 |
631 |
632 // ============================================================================= |
632 // ============================================================================= |
633 // ----------------------------------------------------------------------------- |
633 // ----------------------------------------------------------------------------- |
634 static bool isColorUsed (short colnum) { |
634 static bool isColorUsed (short colnum) { |
635 for (LDObject* obj : LDFile::current()->objs()) |
635 for (LDObject* obj : LDFile::current()->objects()) |
636 if (obj->isColored() && obj->color() == colnum) |
636 if (obj->isColored() && obj->color() == colnum) |
637 return true; |
637 return true; |
638 |
638 |
639 return false; |
639 return false; |
640 } |
640 } |
646 |
646 |
647 while (colnum < MAX_COLORS && (getColor (colnum) == null || isColorUsed (colnum))) |
647 while (colnum < MAX_COLORS && (getColor (colnum) == null || isColorUsed (colnum))) |
648 colnum++; |
648 colnum++; |
649 |
649 |
650 if (colnum >= MAX_COLORS) { |
650 if (colnum >= MAX_COLORS) { |
651 //: Auto-colorer error message |
651 log (ForgeWindow::tr ("Cannot auto-color: all colors are in use!")); |
652 critical (ForgeWindow::tr ("Out of unused colors! What are you doing?!")); |
|
653 return; |
652 return; |
654 } |
653 } |
655 |
654 |
656 for (LDObject* obj : g_win->sel()) { |
655 for (LDObject* obj : g_win->sel()) { |
657 if (obj->isColored() == false) |
656 if (obj->isColored() == false) |