Mercurial > hg > svgui
comparison view/Pane.cpp @ 299:5c59c433b358
* Show colour swatch next to layer name in pane (if available)
* Fix for incorrect layer name prefix handling (was making some layers appear
to have the same model name in cases where the model names differed by the
final character only)
author | Chris Cannam |
---|---|
date | Wed, 05 Sep 2007 15:17:15 +0000 |
parents | 919740b20cc9 |
children | 0824a754a8eb |
comparison
equal
deleted
inserted
replaced
298:226cb289bdf4 | 299:5c59c433b358 |
---|---|
714 if (r.y() + r.height() < height() - int(m_layers.size()) * fontHeight - 6) { | 714 if (r.y() + r.height() < height() - int(m_layers.size()) * fontHeight - 6) { |
715 return; | 715 return; |
716 } | 716 } |
717 | 717 |
718 QStringList texts; | 718 QStringList texts; |
719 std::vector<QPixmap> pixmaps; | |
719 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 720 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { |
720 texts.push_back((*i)->getLayerPresentationName()); | 721 texts.push_back((*i)->getLayerPresentationName()); |
722 // std::cerr << "Pane " << this << ": Layer presentation name for " << *i << ": " | |
723 // << texts[texts.size()-1].toStdString() << std::endl; | |
724 pixmaps.push_back((*i)->getLayerPresentationPixmap | |
725 (QSize(fontAscent, fontAscent))); | |
721 } | 726 } |
722 | 727 |
723 int maxTextWidth = width() / 3; | 728 int maxTextWidth = width() / 3; |
724 texts = TextAbbrev::abbreviate(texts, paint.fontMetrics(), maxTextWidth); | 729 texts = TextAbbrev::abbreviate(texts, paint.fontMetrics(), maxTextWidth); |
725 | 730 |
732 } | 737 } |
733 | 738 |
734 if (r.x() + r.width() >= llx) { | 739 if (r.x() + r.width() >= llx) { |
735 | 740 |
736 for (size_t i = 0; i < texts.size(); ++i) { | 741 for (size_t i = 0; i < texts.size(); ++i) { |
742 | |
743 // std::cerr << "Pane "<< this << ": text " << i << ": " << texts[i].toStdString() << std::endl; | |
737 | 744 |
738 if (i + 1 == texts.size()) { | 745 if (i + 1 == texts.size()) { |
739 paint.setPen(getForeground()); | 746 paint.setPen(getForeground()); |
740 } | 747 } |
741 | 748 |
742 drawVisibleText(paint, llx, | 749 drawVisibleText(paint, llx, |
743 lly - fontHeight + fontAscent, | 750 lly - fontHeight + fontAscent, |
744 texts[i], OutlinedText); | 751 texts[i], OutlinedText); |
752 | |
753 if (!pixmaps[i].isNull()) { | |
754 paint.drawPixmap(llx - fontAscent - 3, | |
755 lly - fontHeight + (fontHeight-fontAscent)/2, | |
756 pixmaps[i]); | |
757 } | |
745 | 758 |
746 lly -= fontHeight; | 759 lly -= fontHeight; |
747 } | 760 } |
748 } | 761 } |
749 } | 762 } |