From 1bd4f2e8d9745cabb667b043171cad22c8577768 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sun, 6 Mar 2011 19:08:32 +0000 Subject: draw parts while recording --- muse2/ChangeLog | 3 ++- muse2/muse/arranger/pcanvas.cpp | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 54435102..8b1b02e2 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,5 @@ +06.03.2011: + - added simple part drawing while recording, does not draw events or waveform (rj) 05.03.2011: - Store toolbuttons in song file (rj) - Fixed issue with opening editors (rj) @@ -5,7 +7,6 @@ - detect samplerate and warn if samplerate isn't same in song and system (rj) - adjust columns and store size of shortcut dialog (rj) - Fixed up some missing keyboard accelerators for menus (rj) - 01.03.2011: - Added feature to show/hide track-types from arranger, this far only with toolbuttons and no persistent storage (rj) 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(); } //--------------------------------------------------------- -- cgit v1.2.3