src/gui.cpp

changeset 364
7c3af0a6f8ab
parent 360
77f08db90249
child 376
4a89dd47535f
equal deleted inserted replaced
363:75583c9f289d 364:7c3af0a6f8ab
423 423
424 for (str colorname : gui_colortoolbar.value.split (":")) { 424 for (str colorname : gui_colortoolbar.value.split (":")) {
425 if (colorname == "|") { 425 if (colorname == "|") {
426 meta << quickColor ({null, null, true}); 426 meta << quickColor ({null, null, true});
427 } else { 427 } else {
428 color* col = getColor (colorname.toLong ()); 428 LDColor* col = getColor (colorname.toLong ());
429 assert (col != null); 429 assert (col != null);
430 meta << quickColor ({col, null, false}); 430 meta << quickColor ({col, null, false});
431 } 431 }
432 } 432 }
433 433
670 } elif (lv_colorize && obj->isColored () && 670 } elif (lv_colorize && obj->isColored () &&
671 obj->color () != maincolor && obj->color () != edgecolor) 671 obj->color () != maincolor && obj->color () != edgecolor)
672 { 672 {
673 // If the object isn't in the main or edge color, draw this 673 // If the object isn't in the main or edge color, draw this
674 // list entry in said color. 674 // list entry in said color.
675 color* col = getColor (obj->color ()); 675 LDColor* col = getColor (obj->color ());
676 if (col) 676 if (col)
677 item->setForeground (col->faceColor); 677 item->setForeground (col->faceColor);
678 } 678 }
679 679
680 obj->qObjListEntry = item; 680 obj->qObjListEntry = item;
756 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 756 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
757 // ============================================================================= 757 // =============================================================================
758 void ForgeWindow::slot_quickColor () { 758 void ForgeWindow::slot_quickColor () {
759 g_curfile->openHistory (); 759 g_curfile->openHistory ();
760 QToolButton* button = static_cast<QToolButton*> (sender ()); 760 QToolButton* button = static_cast<QToolButton*> (sender ());
761 color* col = null; 761 LDColor* col = null;
762 762
763 for (quickColor entry : m_colorMeta) { 763 for (quickColor entry : m_colorMeta) {
764 if (entry.btn == button) { 764 if (entry.btn == button) {
765 col = entry.col; 765 col = entry.col;
766 break; 766 break;
1100 abort (); 1100 abort ();
1101 return null; 1101 return null;
1102 } 1102 }
1103 1103
1104 // ============================================================================= 1104 // =============================================================================
1105 QIcon makeColorIcon (color* colinfo, const ushort size) { 1105 QIcon makeColorIcon (LDColor* colinfo, const ushort size) {
1106 // Create an image object and link a painter to it. 1106 // Create an image object and link a painter to it.
1107 QImage img (size, size, QImage::Format_ARGB32); 1107 QImage img (size, size, QImage::Format_ARGB32);
1108 QPainter paint (&img); 1108 QPainter paint (&img);
1109 1109
1110 QColor col = colinfo->faceColor; 1110 QColor col = colinfo->faceColor;
1136 } 1136 }
1137 1137
1138 box->clear (); 1138 box->clear ();
1139 ulong row = 0; 1139 ulong row = 0;
1140 for (const auto& pair : counts) { 1140 for (const auto& pair : counts) {
1141 color* col = getColor (pair.first); 1141 LDColor* col = getColor (pair.first);
1142 assert (col != null); 1142 assert (col != null);
1143 1143
1144 QIcon ico = makeColorIcon (col, 16); 1144 QIcon ico = makeColorIcon (col, 16);
1145 box->addItem (ico, fmt ("[%1] %2 (%3 object%4)", 1145 box->addItem (ico, fmt ("[%1] %2 (%3 object%4)",
1146 pair.first, col->name, pair.second, plural (pair.second))); 1146 pair.first, col->name, pair.second, plural (pair.second)));

mercurial