summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2011-04-16 04:50:17 +0000
committerTim E. Real <termtech@rogers.com>2011-04-16 04:50:17 +0000
commitf644f66566e933364baa66c825799ab7de3b4bbe (patch)
treebed6deda9de56be32ceb2b2b8b6d00815eb4b64a /muse2/muse
parent1a551c32ee9395ee83cc96245d7a5d30d3eebe13 (diff)
Move part name text to bottom to accommodate drum 'slivers'
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/arranger/pcanvas.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 57cccbf7..e2c2b32d 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -1610,15 +1610,20 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
// draw name
// FN: Set text color depending on part color (black / white)
int part_r, part_g, part_b, brightness;
- config.partColors[i].getRgb(&part_r, &part_g, &part_b);
+ //config.partColors[i].getRgb(&part_r, &part_g, &part_b);
+ // Since we'll draw the text on the bottom (to accommodate drum 'slivers'),
+ // get the lowest colour in the gradient used to draw the part.
+ QRect rr = map(r);
+ rr.setX(rr.x() + 3);
+ gGradientFromQColor(config.partColors[i], rr.topLeft(), rr.bottomLeft()).stops().last().second.getRgb(&part_r, &part_g, &part_b);
brightness = part_r*29 + part_g*59 + part_b*12;
//if (brightness < 12000 || part->selected())
// p.setPen(Qt::white); /* too dark: use white for text color */
//else
// p.setPen(Qt::black); /* otherwise use black */
bool rev = brightness < 12000 || part->selected();
- QRect rr = map(r);
- rr.setX(rr.x() + 3);
+ //QRect rr = map(r);
+ //rr.setX(rr.x() + 3);
p.save();
p.setFont(config.fonts[1]);
p.setWorldMatrixEnabled(false);
@@ -1626,12 +1631,12 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
p.setPen(Qt::black);
else
p.setPen(Qt::white);
- p.drawText(rr.translated(1, 1), Qt::AlignTop|Qt::AlignLeft, part->name());
+ p.drawText(rr.translated(1, 1), Qt::AlignBottom|Qt::AlignLeft, part->name());
if (rev)
p.setPen(Qt::white);
else
p.setPen(Qt::black);
- p.drawText(rr, Qt::AlignTop|Qt::AlignLeft, part->name());
+ p.drawText(rr, Qt::AlignBottom|Qt::AlignLeft, part->name());
p.restore();
}
}