summaryrefslogtreecommitdiff
path: root/muse2/muse/arranger/pcanvas.cpp
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2011-04-14 23:13:03 +0000
committerTim E. Real <termtech@rogers.com>2011-04-14 23:13:03 +0000
commit8acbc05a692368347cffa794d047dc4839ad6b78 (patch)
tree746224e249a57b11ff4cbbce8726a407693bdcd8 /muse2/muse/arranger/pcanvas.cpp
parent1d3741efd41bdcde88f05b210ebae218acc6967d (diff)
Fix arranger midi part event 'sliver' drawing. Fix partname drawing.
Remove dssi gui killtimers causing error.
Diffstat (limited to 'muse2/muse/arranger/pcanvas.cpp')
-rw-r--r--muse2/muse/arranger/pcanvas.cpp47
1 files changed, 37 insertions, 10 deletions
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 5747726f..4fc0c3dd 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -1593,7 +1593,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
drawWavePart(p, rect, wp, r);
else if (mp)
{
- drawMidiPart(p, rect, mp->events(),(MidiTrack*)part->track(), r, mp->tick(), from, to);
+ drawMidiPart(p, rect, mp->events(), (MidiTrack*)part->track(), mp, r, mp->tick(), from, to);
}
if (config.canvasShowPartType & 1) { // show names
@@ -1602,16 +1602,27 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
int part_r, part_g, part_b, brightness;
config.partColors[i].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 */
+ //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);
p.save();
p.setFont(config.fonts[1]);
p.setWorldMatrixEnabled(false);
- p.drawText(rr, Qt::AlignVCenter|Qt::AlignLeft, part->name());
+ if (rev)
+ p.setPen(Qt::black);
+ else
+ p.setPen(Qt::white);
+ p.drawText(rr, Qt::AlignTop|Qt::AlignLeft, part->name());
+ rr.translate(1,1);
+ if (rev)
+ p.setPen(Qt::white);
+ else
+ p.setPen(Qt::black);
+ p.drawText(rr, Qt::AlignTop|Qt::AlignLeft, part->name());
p.restore();
}
}
@@ -1649,14 +1660,30 @@ void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&)
// pr - part rectangle
//---------------------------------------------------------
-void PartCanvas::drawMidiPart(QPainter& p, const QRect& bb, EventList* events, MidiTrack *mt, const QRect& r, int pTick, int from, int to)
+void PartCanvas::drawMidiPart(QPainter& p, const QRect& bb, EventList* events, MidiTrack *mt, MidiPart *pt, const QRect& r, int pTick, int from, int to)
{
//printf("x=%d y=%d h=%d w=%d\n",r.x(),r.y(),r.height(),r.width());
+
+ if(pt)
+ {
+ int part_r, part_g, part_b, brightness;
+ config.partColors[pt->colorIndex()].getRgb(&part_r, &part_g, &part_b);
+ brightness = part_r*29 + part_g*59 + part_b*12;
+ if (brightness < 12000 || pt->selected())
+ //p.setPen(Qt::white); // too dark: use white for color
+ p.setPen(QColor(192,192,192)); // too dark: use lighter color
+ else
+ //p.setPen(Qt::black); // otherwise use black
+ p.setPen(QColor(64,64,64)); // otherwise use dark color
+ }
+ else
+ p.setPen(QColor(80,80,80));
+
if (config.canvasShowPartType & 2) { // show events
// Do not allow this, causes segfault.
if(from <= to)
{
- p.setPen(QColor(80,80,80));
+ //p.setPen(QColor(80,80,80));
//EventList* events = mp->events();
iEvent ito(events->lower_bound(to));
@@ -1678,7 +1705,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect& bb, EventList* events, M
}
}
else { // show Cakewalk Style
- p.setPen(QColor(80,80,80));
+ //p.setPen(QColor(80,80,80));
//EventList* events = mp->events();
iEvent ito(events->lower_bound(to));
//printf("PartCanvas::drawItem pTick:%d from:%d to:%d\n", pTick, from, to);
@@ -3047,7 +3074,7 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect)
}
}
}
- drawMidiPart(p, rect, &myEventList, mt, partRect,startPos,0,song->cpos()-startPos);
+ drawMidiPart(p, rect, &myEventList, mt, 0, partRect,startPos,0,song->cpos()-startPos);
}
yPos+=track->height();
}