diff options
author | Robert Jonsson <spamatica@gmail.com> | 2011-03-06 19:08:32 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2011-03-06 19:08:32 +0000 |
commit | 1bd4f2e8d9745cabb667b043171cad22c8577768 (patch) | |
tree | bab523dd54a65542d9f3c8b56adc87d7e1ff6558 /muse2/muse/arranger/pcanvas.cpp | |
parent | 03b22522651de83a45494a2745f05b7a19ecb3d7 (diff) |
draw parts while recording
Diffstat (limited to 'muse2/muse/arranger/pcanvas.cpp')
-rw-r--r-- | muse2/muse/arranger/pcanvas.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 0317d99e..69412542 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -2936,6 +2936,43 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) } yy += track->height(); } + + QRect rr = p.worldMatrix().mapRect(rect); + + p.save(); + p.resetTransform(); + + // primitive write recording while it happens + // should be enhanced/exchanged with solution that draws events and waveform + ypos=0; + if (song->record() && audio->isPlaying()) { + for (iTrack it = tl->begin(); it != tl->end(); ++it) { + Track* track = *it; + if (track->recordFlag()) { + int startPos = audio->getStartRecordPos().tick(); + if (song->punchin()) + startPos=song->lpos(); + if (song->punchout() && song->cpos() > song->rpos()) { + continue; // no drawing if we are beyond punch out. + } + + + if (song->cpos() > startPos) { + int startx = mapx(startPos); + int width = mapx(song->cpos()) - mapx(startPos); + + p.fillRect(startx,ypos, width, track->height(), config.partColors[0]); + p.setPen(Qt::black); + p.drawLine(startx,ypos,startx+width, ypos); + p.drawLine(startx,ypos+1,startx+width, ypos+1); + p.drawLine(startx,ypos+track->height(),startx+width, ypos+track->height()); + p.drawLine(startx,ypos+track->height()-1,startx+width, ypos+track->height()-1); + } + } + ypos+=track->height(); + } + } + p.restore(); } //--------------------------------------------------------- |